Skip to content

Commit 4c46e85

Browse files
committed
Fix "Dereference of a possibly null reference"
1 parent 03acb6a commit 4c46e85

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/TryMudBlazor.Server/Program.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using MudBlazor;
21
using MudBlazor.Examples.Data;
32

43
namespace TryMudBlazor.Server;
@@ -43,10 +42,18 @@ public static void Main(string[] args)
4342

4443
app.MapControllers();
4544

46-
var v = typeof(MudText).Assembly.GetName().Version;
47-
var cacheBusting = $"v{v.Major}.{v.Minor}.{v.Build}";
48-
app.MapFallbackToFile("index.html").CacheOutput(policy => policy.SetVaryByQuery("cachebust", cacheBusting));
45+
var version = GetVersion();
46+
var cacheBusting = $"v{version.Major}.{version.Minor}.{version.Build}";
47+
app.MapFallbackToFile("index.html")
48+
.CacheOutput(policy => policy.SetVaryByQuery("cachebust", cacheBusting));
4949

5050
app.Run();
5151
}
52+
53+
private static Version GetVersion()
54+
{
55+
var version = typeof(MudBlazor._Imports).Assembly.GetName().Version;
56+
57+
return version ?? new Version(0, 0, 0);
58+
}
5259
}

0 commit comments

Comments
 (0)