fix bug in sprintf with null %s

This commit is contained in:
zeromus 2015-11-08 20:22:39 -06:00
parent 53fcc09c08
commit 466ce0f696
1 changed files with 3 additions and 1 deletions

View File

@ -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 );