Skip to content

Commit abb8913

Browse files
author
Nick Gravelyn
committed
Adding check to _endBackgroundTask to verify the application exists before calling GWS_DNOT_REACHED.
This enables what is admittedly a rare scenario which is running these servers inside application-less unit tests where there is no UIApplication.
1 parent 059f5c8 commit abb8913

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

GCDWebServer/Core/GCDWebServer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ - (void)_endBackgroundTask {
283283
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTask];
284284
_backgroundTask = UIBackgroundTaskInvalid;
285285
GWS_LOG_DEBUG(@"Did end background task");
286-
} else {
286+
} else if ([UIApplication sharedApplication]) {
287287
GWS_DNOT_REACHED();
288288
}
289289
}

0 commit comments

Comments
 (0)