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.
This commit is contained in:
Jakub Kądziołka 2021-02-27 19:29:06 +01:00
parent 54d733f356
commit e8bfc4050e
No known key found for this signature in database
GPG Key ID: E315A75846131564

View File

@ -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) {