Protect against potential "index out of range" panic.