Verify that the registry value exists before deleting it
@@ -118,26 +118,20 @@ public class SettingsManager {
}
else
{
-
- if (Spark.isWindows())
- {
+ if (Spark.isWindows()) {
+ if (Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"+SparkRes.getString(SparkRes.APP_NAME))) {
try {
- String run = Advapi32Util.registryGetStringValue(
- WinReg.HKEY_CURRENT_USER,
- "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
- SparkRes.getString(SparkRes.APP_NAME));
- if (run != null)
- {
Advapi32Util.registryDeleteValue(
WinReg.HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
SparkRes.getString(SparkRes.APP_NAME));
}
- }
catch (Exception e) {
Log.error("Can not delete registry entry",e);
}
}
+
+ }
}
}
