summaryrefslogtreecommitdiff
path: root/libjava/java/text
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/text')
-rw-r--r--libjava/java/text/MessageFormat.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/libjava/java/text/MessageFormat.java b/libjava/java/text/MessageFormat.java
index 4a24afd1f44..8d53ec21ec1 100644
--- a/libjava/java/text/MessageFormat.java
+++ b/libjava/java/text/MessageFormat.java
@@ -658,7 +658,11 @@ public class MessageFormat extends Format
{
// We have a String format. This can lose in a number
// of ways, but we give it a shot.
- int next_index = sourceStr.indexOf(elements[i].trailer, index);
+ int next_index;
+ if (elements[i].trailer.length() > 0)
+ next_index = sourceStr.indexOf(elements[i].trailer, index);
+ else
+ next_index = sourceStr.length();
if (next_index == -1)
{
pos.setErrorIndex(index);