That was actually intentional, as it ends up being an array lookup, and having to check array bounds all the time wasn't great - so it fell back to the first thing in the list.
Maybe I should create another version of that function, something like TryGetSpriteIdByName which returns a bool, and writes to an int ref, so at least you'll be aware of it failing.
Edit: Would that work for you?