mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Fix a crash when apps are removed from GFE
This commit is contained in:
@@ -146,6 +146,7 @@ static NSMutableSet* hostList;
|
|||||||
BOOL appAlreadyInList = NO;
|
BOOL appAlreadyInList = NO;
|
||||||
for (App* savedApp in host.appList) {
|
for (App* savedApp in host.appList) {
|
||||||
if ([app.id isEqualToString:savedApp.id]) {
|
if ([app.id isEqualToString:savedApp.id]) {
|
||||||
|
savedApp.name = app.name;
|
||||||
savedApp.isRunning = app.isRunning;
|
savedApp.isRunning = app.isRunning;
|
||||||
appAlreadyInList = YES;
|
appAlreadyInList = YES;
|
||||||
break;
|
break;
|
||||||
@@ -157,18 +158,29 @@ static NSMutableSet* hostList;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (App* app in host.appList) {
|
BOOL appWasRemoved;
|
||||||
BOOL appWasRemoved = YES;
|
do {
|
||||||
for (App* mergedApp in newList) {
|
appWasRemoved = NO;
|
||||||
if ([mergedApp.id isEqualToString:app.id]) {
|
|
||||||
appWasRemoved = NO;
|
for (App* app in host.appList) {
|
||||||
|
appWasRemoved = YES;
|
||||||
|
for (App* mergedApp in newList) {
|
||||||
|
if ([mergedApp.id isEqualToString:app.id]) {
|
||||||
|
appWasRemoved = NO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (appWasRemoved) {
|
||||||
|
// Removing the app mutates the list we're iterating (which isn't legal).
|
||||||
|
// We need to jump out of this loop and restart enumeration.
|
||||||
|
[database removeAppFromHost:app];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (appWasRemoved) {
|
|
||||||
[database removeAppFromHost:app];
|
// Keep looping until the list is no longer being mutated
|
||||||
}
|
} while (appWasRemoved);
|
||||||
}
|
|
||||||
[database saveData];
|
[database saveData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user