Add a failsafe to Nyma's settings callback to avoid NREs

This commit is contained in:
James Groom 2024-04-30 22:06:59 +10:00 committed by GitHub
parent fa0c693448
commit 4c7ea21cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
private unsafe void SettingsQuery(string name, IntPtr dest)
{
var val = SettingsQuery(name);
var bytes = Encoding.UTF8.GetBytes(val);
var bytes = val is null ? Array.Empty<byte>() : Encoding.UTF8.GetBytes(val);
if (bytes.Length > 255)
{
throw new InvalidOperationException($"Value {val} for setting {name} was too long");