= Adjusted user parsing, requiring proper formatting now.

This commit is contained in:
Matthew Cech
2019-06-02 20:22:31 -07:00
parent 6ce380a067
commit 2fbb74198c
+7 -6
View File
@@ -70,18 +70,19 @@ public class KittyUser extends DatabaseTrackedObject
try try
{ {
String[] strings = string.split(","); String[] strings = string.split(",");
beans = Integer.parseInt(strings[0]); if(strings.length < 2)
if(strings.length > 1)
{
role = KittyRole.valueOf(Integer.parseInt(strings[1])).get();
}
else
{ {
GlobalLog.Log(LogFilter.Database, "Upgrading user " + name + " to include 'role' in DB"); GlobalLog.Log(LogFilter.Database, "Upgrading user " + name + " to include 'role' in DB");
// Mark ourselves dirty to re-write the role information stored in the user. // Mark ourselves dirty to re-write the role information stored in the user.
// Just uses defaults from earlier again. // Just uses defaults from earlier again.
MarkDirty(); MarkDirty();
} }
else
{
beans = Integer.parseInt(strings[0]);
role = KittyRole.valueOf(Integer.parseInt(strings[1])).get();
}
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {