From 466ce0f69604f25974fa9b218df86c5789dddf97 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 8 Nov 2015 20:22:39 -0600 Subject: [PATCH] fix bug in sprintf with null %s --- BizHawk.Common/Sprintf.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BizHawk.Common/Sprintf.cs b/BizHawk.Common/Sprintf.cs index faa3ef4699..010e3635fe 100644 --- a/BizHawk.Common/Sprintf.cs +++ b/BizHawk.Common/Sprintf.cs @@ -442,7 +442,9 @@ namespace BizHawk.Common #region s - string case 's': // string string t = "{0" + ( fieldLength != int.MinValue ? "," + ( flagLeft2Right ? "-" : String.Empty ) + fieldLength.ToString() : String.Empty ) + ":s}"; - w = Marshal.PtrToStringAnsi(n); + if (n == IntPtr.Zero) + w = "(null)"; + else w = Marshal.PtrToStringAnsi(n); if ( fieldPrecision >= 0 ) w = w.Substring( 0, fieldPrecision );