Permalink
Browse files

front: Don't process empty cheat lines

1 parent d7f3e89 commit 2474cf16b636573adc8eff07d5ad8d7dd8e3829f @fzurita fzurita committed Apr 24, 2016
@@ -421,7 +421,7 @@ public void onEditComplete(int selectedButton, String name, String comment, List
}
cheat.option = builder.toString();
- boolean ValidCheat = !name.isEmpty() && cheat.code.length() > 8;
+ boolean ValidCheat = !name.isEmpty() && cheat.code.length() > 12;
if(ValidCheat)
{
@@ -273,22 +273,25 @@ private void populateCheatsFromText()
for(String address : addressStrings)
{
- CheatAddressData addressData = new CheatAddressData();
-
- String addressString = address.substring(0, 8);
- String valueString = address.substring(address.length()-4, address.length());
-
- addressData.address = Long.valueOf(addressString, 16);
- if(!valueString.contains("?"))
- {
- addressData.value = Integer.valueOf(valueString, 16);
- mAddresses.add(addressData);
- }
- else
+ if(!TextUtils.isEmpty(address))
{
- //The cheat with the option goes at the front
- addressData.value = -1;
- mAddresses.add(0, addressData);
+ CheatAddressData addressData = new CheatAddressData();
+
+ String addressString = address.substring(0, 8);
+ String valueString = address.substring(address.length()-4, address.length());
+
+ addressData.address = Long.valueOf(addressString, 16);
+ if(!valueString.contains("?"))
+ {
+ addressData.value = Integer.valueOf(valueString, 16);
+ mAddresses.add(addressData);
+ }
+ else
+ {
+ //The cheat with the option goes at the front
+ addressData.value = -1;
+ mAddresses.add(0, addressData);
+ }
}
}
}
@@ -301,11 +304,14 @@ private void populateCheatsFromText()
for(String option : optionStrings)
{
- CheatOptionData cheatData = new CheatOptionData();
- String valueString = option.substring(option.length()-4, option.length());
- cheatData.value = Integer.valueOf(valueString, 16);
- cheatData.description = option.substring(0, option.length() - 5);
- mOptionItems.add(cheatData);
+ if(!TextUtils.isEmpty(option))
+ {
+ CheatOptionData cheatData = new CheatOptionData();
+ String valueString = option.substring(option.length()-4, option.length());
+ cheatData.value = Integer.valueOf(valueString, 16);
+ cheatData.description = option.substring(0, option.length() - 5);
+ mOptionItems.add(cheatData);
+ }
}
}
}
@@ -461,7 +467,7 @@ private void setValues(final TextWatcher fieldValidator)
* Checks whether a candidate name is unique, non-empty, and contains only
* safe characters. Unsafe characters are: '[', ']'.
*
- * @param profileNames
+ * @param cheatNames
* list of profile names to compare against
* @param oldName
* the old name

0 comments on commit 2474cf1

Please sign in to comment.