From e8bfc4050eb976968b5f8f41ffb6293363e9e839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= Date: Sat, 27 Feb 2021 19:29:06 +0100 Subject: [PATCH] Fix off-by-one in symbol search Before this commit, printing an address that's after every symbol in a bank would not show it relative to the last symbol. --- Core/symbol_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/symbol_hash.c b/Core/symbol_hash.c index 75a7837..a3718b8 100644 --- a/Core/symbol_hash.c +++ b/Core/symbol_hash.c @@ -40,7 +40,7 @@ const GB_bank_symbol_t *GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr) { if (!map) return NULL; size_t index = GB_map_find_symbol_index(map, addr); - if (index < map->n_symbols && map->symbols[index].addr != addr) { + if (index >= map->n_symbols || map->symbols[index].addr != addr) { index--; } if (index < map->n_symbols) {