Browse Source

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.
Nick Gravelyn 10 years ago
parent
commit
abb891334a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      GCDWebServer/Core/GCDWebServer.m

+ 1 - 1
GCDWebServer/Core/GCDWebServer.m

@@ -283,7 +283,7 @@ static void _ExecuteMainThreadRunLoopSources() {
     [[UIApplication sharedApplication] endBackgroundTask:_backgroundTask];
     _backgroundTask = UIBackgroundTaskInvalid;
     GWS_LOG_DEBUG(@"Did end background task");
-  } else {
+  } else if ([UIApplication sharedApplication]) {
     GWS_DNOT_REACHED();
   }
 }