Fix dead pointer usage on factory destruction during secondary order editing of said factory.

Right-clicking a factory just before it's destroyed no longer crashes.
master
Cyp 2012-01-11 17:28:29 +01:00
parent 2249996f1c
commit aaf0fb8798
1 changed files with 5 additions and 0 deletions

View File

@ -976,6 +976,11 @@ void intRunOrder(void)
// Remove any NULL pointers from SelectedDroids.
SelectedDroids.erase(std::remove(SelectedDroids.begin(), SelectedDroids.end(), (DROID *)NULL), SelectedDroids.end());
if (psSelectedFactory != NULL && psSelectedFactory->died)
{
psSelectedFactory = NULL;
}
// If all dead then remove the screen.
// If droids no longer selected then remove screen.
if (SelectedDroids.empty())