refactor: early return in saveValue

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2023-01-07 11:24:07 +01:00
parent eea37a9bad
commit 915b8d371a
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -103,16 +103,17 @@ public enum SettingsEnum {
public void saveValue(Object newValue) {
Context context = ReVancedUtils.getAppContext();
if (context != null) {
if (context == null) {
LogHelper.printException(SettingsEnum.class, "Context on SaveValue is null!");
return;
}
if (returnType == ReturnType.BOOLEAN) {
SharedPrefHelper.saveBoolean(context, sharedPref, path, (Boolean) newValue);
} else {
SharedPrefHelper.saveString(context, sharedPref, path, newValue + "");
}
value = newValue;
} else {
LogHelper.printException(SettingsEnum.class, "Context on SaveValue is null!");
}
}
public int getInt() {