浏览代码

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 年之前
父节点
当前提交
abb891334a
共有 1 个文件被更改,包括 1 次插入1 次删除
  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();
   }
 }