Skip to content

Commit c09aa93

Browse files
committed
fixed bug: PendingAddToRegistry and SeenInRegistry are both true but because of the former, it still tries to add it (causing an exception)
1 parent 3b368d9 commit c09aa93

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

GPUPrefSwitcher/Switcher.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ private static async Task RunUpdateLogic()
230230
WriteRegistryToXML();
231231
}
232232

233-
WriteXMLToRegistry(currentPowerLineStatus);
234-
233+
//This NEEDS to come before (XML -> Registry) and after (Registry -> XML) (XML -> Registry depends on this)
235234
UpdateSeenInRegistryStatuses(); //sets the SeenInRegistry entry accordingly
236235

236+
WriteXMLToRegistry(currentPowerLineStatus);
237+
237238
AppEntrySaveHandler appEntrySaveHandler = await appEntryLibrarian.Borrow();
238239
Task swaps = BeginFileSwapLogic(currentPowerLineStatus, appEntrySaveHandler.CurrentAppEntries);
239240
appEntryLibrarian.Return(appEntrySaveHandler);
@@ -491,7 +492,7 @@ internal static void WriteXMLToRegistry(PowerLineStatus powerLineStatus)
491492
foreach (AppEntry appEntry in appEntries)
492493
{
493494

494-
if (appEntry.PendingAddToRegistry)
495+
if (appEntry.PendingAddToRegistry && !appEntry.SeenInRegistry)
495496
{
496497

497498
Logger.inst.Log($"Pending registry add detected: {appEntry.AppPath}");

0 commit comments

Comments
 (0)