Browse Source

Fix plMouseDevice crash

plMouseDevice::HideCursor can crash if it is called before the cursor is
created. This happens if the client pops up a disconnected dialog before
initialization is complete. I've seen it happen!
Adam Johnson 11 years ago
parent
commit
acb980332f
  1. 10
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp

10
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp

@ -352,7 +352,7 @@ void plMouseDevice::SetCursorY(float y)
void plMouseDevice::HideCursor(bool override)
{
if( fInstance->fCursor != nil )
if ( fInstance && fInstance->fCursor )
fInstance->fCursor->SetVisible( false );
plMouseDevice::bCursorOverride = (override != 0);
@ -370,9 +370,11 @@ void plMouseDevice::ShowCursor(bool override)
plMouseDevice::bCursorHidden = false;
plMouseDevice::bCursorOverride = false;
if( fInstance->fCursor == nil )
fInstance->CreateCursor( fInstance->fCursorID );
fInstance->fCursor->SetVisible( true );
if (fInstance) {
if (!fInstance->fCursor)
fInstance->CreateCursor(fInstance->fCursorID);
fInstance->fCursor->SetVisible(true);
}
}
void plMouseDevice::NewCursor(char* cursor)

Loading…
Cancel
Save