fix: Warn when sending empty gumps (#2563)

### Summary

Generates a console warning when users receive an empty gump. This will help prevent client side leaks.
This commit is contained in:
Guflly 2026-08-08 00:55:12 -07:00 • committed by GitHub
parent b2c59191bd
commit 64e6fe5da8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 114 additions and 0 deletions

View file

@ -30,6 +30,7 @@ public abstract class StaticGump<TSelf> : BaseGump where TSelf : StaticGump<TSel
private static byte[] _compressedStringsData;
private static bool _hasDynamicStrings;
private static bool _cachedHasVisualElements;
private static int _staticStringsCount;
private static byte[] _staticStrings;
@ -72,6 +73,7 @@ public abstract class StaticGump<TSelf> : BaseGump where TSelf : StaticGump<TSel
if (Cached && _compressedLayoutData != null)
{
HasVisualElements = _cachedHasVisualElements;
writer.Write(_compressedLayoutData);
if (_compressedStringsData != null)
@ -116,6 +118,7 @@ public abstract class StaticGump<TSelf> : BaseGump where TSelf : StaticGump<TSel
BuildLayout(ref gumpBuilder);
gumpBuilder.FinalizeLayout();
HasVisualElements = _cachedHasVisualElements = gumpBuilder.HasVisualElements;
_switches = gumpBuilder.Switches;
_textEntries = gumpBuilder.TextEntries;
_staticStringsCount = gumpBuilder._stringsCount;