Quellcode durchsuchen

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 vor 10 Jahren
Ursprung
Commit
abb891334a
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      GCDWebServer/Core/GCDWebServer.m

+ 1 - 1
GCDWebServer/Core/GCDWebServer.m

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