From e8ee75de6f8ff6604cdd882e819eff4df60fe73f Mon Sep 17 00:00:00 2001 From: Erik Mavrinac Date: Fri, 8 Mar 2024 15:01:40 -0800 Subject: [PATCH] Fast fix for NullRefException from FileAppender --- src/log4net/Appender/FileAppender.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs index 4179190d..14a3e359 100644 --- a/src/log4net/Appender/FileAppender.cs +++ b/src/log4net/Appender/FileAppender.cs @@ -169,7 +169,7 @@ private LockStateException(SerializationInfo info, StreamingContext context) : b } private Stream m_realStream = null; - private LockingModelBase m_lockingModel = null; + private readonly LockingModelBase m_lockingModel; private int m_lockLevel = 0; public LockingStream(LockingModelBase locking) @@ -1306,7 +1306,7 @@ protected override void Reset() protected override void OnClose() { base.OnClose(); - m_lockingModel.OnClose(); + m_lockingModel?.OnClose(); } ///