SDLCursorManager: fix possibly invalid read when no cursor present

On android we have no cursor so I moved the check closer to usage
pull/375/head^2
Ilya Zhuravlev 7 years ago
parent d2121ccd62
commit a038327521

@ -203,19 +203,14 @@ namespace SDLUtil
void SDLCursorManager::cursorChanged(const std::string& name)
{
mCurrentCursor = name;
CursorMap::const_iterator curs_iter = mCursorMap.find(name);
if(curs_iter != mCursorMap.end())
{
//we have this cursor
_setGUICursor(name);
}
_setGUICursor(name);
}
void SDLCursorManager::_setGUICursor(const std::string &name)
{
SDL_SetCursor(mCursorMap.find(name)->second);
auto it = mCursorMap.find(name);
if (it != mCursorMap.end())
SDL_SetCursor(it->second);
}
void SDLCursorManager::createCursor(const std::string& name, int rotDegrees, osg::Image* image, Uint8 hotspot_x, Uint8 hotspot_y)

Loading…
Cancel
Save