From 789f8e31a8afcb863e83ccb025f3da2fde953760 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 12 Feb 2016 01:35:53 -0500 Subject: [PATCH] v0.3.4a: added a safety check to capitalize --- .../shatteredpixeldungeon/messages/Messages.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java index f3da1f152..d15ab2dbc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java @@ -145,7 +145,8 @@ public class Messages { } public static String capitalize( String str ){ - return Character.toTitleCase( str.charAt( 0 ) ) + str.substring( 1 ); + if (str.length() == 0) return str; + else return Character.toTitleCase( str.charAt( 0 ) ) + str.substring( 1 ); } //Words which should not be capitalized in title case, mostly prepositions which appear ingame