added check to prevent crash when drawing sprites for undefined graphics