Special handling of empty string builders

This commit is contained in:
Matt Nadareski
2025-09-21 13:41:06 -04:00
parent d3e41ac187
commit 335a486f17

View File

@@ -141,6 +141,10 @@ namespace SabreTools.IO.Extensions
ms.Seek(lastOffset, SeekOrigin.Begin);
reader.DiscardBufferedData();
// If there is no cached string
if (str.Length == 0)
continue;
// Add the string if long enough
if (str.Length >= charLimit)
strings.Add(str);
@@ -209,8 +213,12 @@ namespace SabreTools.IO.Extensions
// Pretend only one byte was read
offset -= width - 1;
// If there is no cached string
if (sb.Length == 0)
continue;
// Add the string if long enough
string str = sb.ToString();
string str = sb.ToString();
if (str.Length >= charLimit)
strings.Add(str);