mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 12:46:09 +01:00
fix for StringIndexOutOfBoundsException caused by overlong string passed to titleize(String str)
This commit is contained in:
parent
2f61e83a8a
commit
86112380da
@ -12,7 +12,11 @@ public class TextUtil {
|
||||
int pivot = line.length() / 2;
|
||||
int eatLeft = center.length() / 2;
|
||||
int eatRight = center.length() - eatLeft;
|
||||
return line.substring(0, pivot - eatLeft) + center + line.substring(pivot + eatRight);
|
||||
|
||||
if (eatLeft < pivot)
|
||||
return line.substring(0, pivot - eatLeft) + center + line.substring(pivot + eatRight);
|
||||
else
|
||||
return center;
|
||||
}
|
||||
|
||||
public static String repeat(String s, int times) {
|
||||
|
Loading…
Reference in New Issue
Block a user