Skip to content

Commit

Permalink
Fix object reference error when trying to detect encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Kees committed Nov 25, 2024
1 parent bb67ad1 commit 5306135
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ChromiumHtmlToPdfLib/Helpers/PreWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public string WrapFile(string inputFile, Encoding? encoding)
using var fileStream = File.OpenRead(inputFile);
_logger?.Info("Trying to detect encoding");
var result = CharsetDetector.DetectFromStream(fileStream);
if (result.Detected.Encoding != null)
if (result.Detected?.Encoding != null)
{
encoding = result.Detected.Encoding;
_logger?.Info("Encoding detection status log: {statusLog}", result.Detected.StatusLog);
Expand Down

0 comments on commit 5306135

Please sign in to comment.