mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-01-22 03:50:59 +00:00
Added checks for null UTF8 inputs
This commit is contained in:
parent
c782115e7f
commit
3e7eaf9d5b
11
src/SDL2.cs
11
src/SDL2.cs
|
@ -68,7 +68,10 @@ namespace SDL2
|
|||
{
|
||||
if (str == null)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
fixed (char* strPtr = str)
|
||||
|
@ -94,7 +97,11 @@ namespace SDL2
|
|||
}
|
||||
internal static unsafe byte* Utf8EncodeNullable(string str)
|
||||
{
|
||||
int bufferSize = Utf8SizeNullable(str);
|
||||
if (str == null)
|
||||
{
|
||||
return (byte*) 0;
|
||||
}
|
||||
int bufferSize = Utf8Size(str);
|
||||
byte* buffer = (byte*) Marshal.AllocHGlobal(bufferSize);
|
||||
fixed (char* strPtr = str)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue