qinchaoyue 1 月之前
父節點
當前提交
0e29edcbcd
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/Hotline.Api/Controllers/FilterController/ExportDataController.cs

+ 2 - 1
src/Hotline.Api/Controllers/FilterController/ExportDataController.cs

@@ -54,7 +54,8 @@ public class ExportDataController : BaseController
             .Where(endpoint => endpoint.RoutePattern.RawText == originalPath)
             .ToList()
             ?? throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
-        var matchingEndpoint = matchingEndpoints.First();
+        var matchingEndpoint = matchingEndpoints.FirstOrDefault();
+        if (matchingEndpoint == null) throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
         if (matchingEndpoints.Count > 1)
         {
             matchingEndpoint = matchingEndpoints.First(m => m.DisplayName.Contains("Get"));