diff --git a/src/ZLogger/Internal/MagicalBox.cs b/src/ZLogger/Internal/MagicalBox.cs index 2bce803..86d608b 100644 --- a/src/ZLogger/Internal/MagicalBox.cs +++ b/src/ZLogger/Internal/MagicalBox.cs @@ -72,9 +72,10 @@ T Read(int offset) return ReaderCache.ReadBoxed(type, this, offset); } - public bool TryReadTo(Type type, int offset, int alignment, string? format, ref Utf8StringWriter> handler) + public bool TryReadTo(Type? type, int offset, int alignment, string? format, ref Utf8StringWriter> handler) { if (offset < 0) return false; + if (type == null) return false; if (type.IsEnum) goto USE_READER; var code = Type.GetTypeCode(type);