Ensure AtkValue is even set before reading it as string

This commit is contained in:
Liza 2024-07-14 23:23:30 +02:00
parent 93fac6efb0
commit acf4a98784
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -7,6 +7,8 @@ public static class LAtkValue
{ {
public static unsafe string? ReadAtkString(this AtkValue atkValue) public static unsafe string? ReadAtkString(this AtkValue atkValue)
{ {
if (atkValue.Type == ValueType.Undefined)
return null;
if (atkValue.String != null) if (atkValue.String != null)
return MemoryHelper.ReadSeStringNullTerminated(new nint(atkValue.String)).ToString(); return MemoryHelper.ReadSeStringNullTerminated(new nint(atkValue.String)).ToString();
return null; return null;