Fix potential crash in restorePreviousVideoMode()
We did get a crash upload about it. And indeed, the display and/or mode
list can asynchronously change, making these IDs invalid. Verify them
before doing anything. The "correct" fix would probably be getting rid
of these IDs, but this will have to wait for later.
Also, the DisplayManager::isValid* methods erroneously accepted negative
IDs as valid, which is definitely wrong. (No, the QMap.size method does
not return an unsigned integer either.)