cleanup nameWithoutVersion() code

This commit is contained in:
Daniel Gultsch 2017-06-24 16:13:55 +02:00
parent 5fd4169720
commit d24022d755
1 changed files with 9 additions and 13 deletions

View File

@ -130,10 +130,7 @@ public class Presences {
private static String nameWithoutVersion(String name) {
String[] parts = name.split(" ");
if (parts.length <= 1) {
return name;
} else {
if (Character.isDigit(parts[parts.length -1].charAt(0))) {
if (parts.length > 1 && Character.isDigit(parts[parts.length -1].charAt(0))) {
StringBuilder output = new StringBuilder();
for(int i = 0; i < parts.length -1; ++i) {
if (output.length() != 0) {
@ -146,5 +143,4 @@ public class Presences {
return name;
}
}
}
}