Skip to content

Commit f9ce502

Browse files
committed
fix NPE in Path.Combine if binPath isn't set
in some special environments (e.g. game engines) AppDomain BaseDirectory isn't set. Workaround: new Configuration().SetProperty( "nhibernate-logger", typeof(Log4NetLoggerFactory).AssemblyQualifiedName )
1 parent 612d1b6 commit f9ce502

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/NHibernate/Logging.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private static string GetNhibernateLoggerClass()
8585
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
8686
string relativeSearchPath = AppDomain.CurrentDomain.RelativeSearchPath;
8787
string binPath = relativeSearchPath == null ? baseDir : Path.Combine(baseDir, relativeSearchPath);
88-
var log4NetDllPath = Path.Combine(binPath, "log4net.dll");
88+
string log4NetDllPath = binPath == null ? "log4net.dll" : Path.Combine(binPath, "log4net.dll");
8989

9090
if (File.Exists(log4NetDllPath))
9191
{
@@ -456,4 +456,4 @@ public void WarnFormat(string format, params object[] args)
456456
WarnFormatDelegate(logger, format, args);
457457
}
458458
}
459-
}
459+
}

0 commit comments

Comments
 (0)