Added null check to exception message formatting

This commit is contained in:
2024-05-17 07:35:09 +02:00
committed by jsaey
parent 1f4f51adc5
commit c997b6c1a2
2 changed files with 10 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
<TargetFrameworks>.netstandard2.1; net6.0; net7.0; net8.0; net4.8;</TargetFrameworks>
<ApplicationIcon>icon.ico</ApplicationIcon>
<LangVersion>latest</LangVersion>
<FileVersion>1.2.8</FileVersion>
<FileVersion>1.2.9</FileVersion>
<Authors>EonaCat (Jeroen Saey)</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>EonaCat (Jeroen Saey)</Company>
@@ -24,7 +24,7 @@
</PropertyGroup>
<PropertyGroup>
<EVRevisionFormat>1.2.8+{chash:10}.{c:ymd}</EVRevisionFormat>
<EVRevisionFormat>1.2.9+{chash:10}.{c:ymd}</EVRevisionFormat>
<EVDefault>true</EVDefault>
<EVInfo>true</EVInfo>
<EVTagMatch>v[0-9]*</EVTagMatch>

View File

@@ -14,8 +14,14 @@ public static class ExceptionExtensions
var st = new StackTrace(exception, true);
var frame = st.GetFrame(0);
var fileLine = frame.GetFileLineNumber();
var filename = frame.GetFileName();
int fileLine = -1;
string filename = "Unknown";
if (frame != null)
{
fileLine = frame.GetFileLineNumber();
filename = frame.GetFileName();
}
var sb = new StringBuilder();