Skip to content

Commit 993785c

Browse files
committed
fix: 添加启动任务为空的检查并输出警告信息
当启动任务为空时,输出警告信息并停止服务器,避免空引用异常
1 parent 139a533 commit 993785c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

GameFrameX.StartUp/GameApp.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ public static async Task Entry(string[] args, Action initAction, Action<LogOptio
257257

258258
ConsoleHelper.ConsoleLogo();
259259

260+
if (_launchTask == default)
261+
{
262+
var message = "The server has been stopped, please check the log for details. (服务器已停止,详情请查看日志.因为启动任务为空。没有找到启动任务。)";
263+
Console.WriteLine($"[Warning] {message}");
264+
LogHelper.Warning(message);
265+
return;
266+
}
267+
260268
await _launchTask;
261269
}
262270

0 commit comments

Comments
 (0)