From fae1e73e54a420d4b93af67e03144d5442825a11 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 24 Jul 2025 01:54:06 -0500 Subject: [PATCH] [nostalgia/gfx] Make getSubSheet check root subsheet name --- src/nostalgia/modules/gfx/src/tilesheet.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nostalgia/modules/gfx/src/tilesheet.cpp b/src/nostalgia/modules/gfx/src/tilesheet.cpp index 3853cddc..d59fec07 100644 --- a/src/nostalgia/modules/gfx/src/tilesheet.cpp +++ b/src/nostalgia/modules/gfx/src/tilesheet.cpp @@ -236,13 +236,19 @@ static ox::Result getSubSheet( ox::Result getSubSheet( ox::SpanView const &idx, TileSheet const &ts) noexcept { - return getSubSheet(idx, 1, ts.subsheet); + if (!idx.empty() && idx[0] == ts.subsheet.name) { + return getSubSheet(idx, 1, ts.subsheet); + } + return ox::Error{1, "SubSheet not found"}; } ox::Result getSubSheet( ox::SpanView const &idx, TileSheet &ts) noexcept { - return getSubSheet(idx, 1, ts.subsheet); + if (!idx.empty() && idx[0] == ts.subsheet.name) { + return getSubSheet(idx, 1, ts.subsheet); + } + return ox::Error{1, "SubSheet not found"}; }