diff Engine/Graphics/Render.cpp @ 2555:67d837007a4c

ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
author a.parshin
date Thu, 14 May 2015 10:34:40 +0200
parents c674d547cc7c
children 44d9df75dc13
line wrap: on
line diff
--- a/Engine/Graphics/Render.cpp	Wed May 13 11:31:58 2015 +0200
+++ b/Engine/Graphics/Render.cpp	Thu May 14 10:34:40 2015 +0200
@@ -1250,28 +1250,49 @@
     }
   }
 
-  for (int i = 0; i < 4; i++)
-  {
-    delete[] this->pAvailableDevices[i].pDriverName;
-    this->pAvailableDevices[i].pDriverName = nullptr;
-
-    delete[] this->pAvailableDevices[i].pDeviceDesc;
-    this->pAvailableDevices[i].pDeviceDesc = nullptr;
-
-    delete[] this->pAvailableDevices[i].pDDraw4DevDesc;
-    this->pAvailableDevices[i].pDDraw4DevDesc = nullptr;
-
-    delete this->pAvailableDevices[i].pDirectDrawGUID;
-    this->pAvailableDevices[i].pDirectDrawGUID = nullptr;
-
-    delete[] this->pAvailableDevices[i].pName;
-    this->pAvailableDevices[i].pName = nullptr;
-
-    delete[] this->pAvailableDevices[i].pDescription;
-    this->pAvailableDevices[i].pDescription = nullptr;
-
-    delete this->pAvailableDevices[i].pGUID;
-    this->pAvailableDevices[i].pGUID = nullptr;
+    for (int i = 0; i < 4; i++)
+    {
+        if (this->pAvailableDevices[i].pDriverName)
+        {
+            delete[] this->pAvailableDevices[i].pDriverName;
+            this->pAvailableDevices[i].pDriverName = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pDeviceDesc)
+        {
+            delete[] this->pAvailableDevices[i].pDeviceDesc;
+            this->pAvailableDevices[i].pDeviceDesc = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pDDraw4DevDesc)
+        {
+            delete[] this->pAvailableDevices[i].pDDraw4DevDesc;
+            this->pAvailableDevices[i].pDDraw4DevDesc = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pDirectDrawGUID)
+        {
+            delete this->pAvailableDevices[i].pDirectDrawGUID;
+            this->pAvailableDevices[i].pDirectDrawGUID = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pName)
+        {
+            delete[] this->pAvailableDevices[i].pName;
+            this->pAvailableDevices[i].pName = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pDescription)
+        {
+            delete[] this->pAvailableDevices[i].pDescription;
+            this->pAvailableDevices[i].pDescription = nullptr;
+        }
+
+        if (this->pAvailableDevices[i].pGUID)
+        {
+            delete this->pAvailableDevices[i].pGUID;
+            this->pAvailableDevices[i].pGUID = nullptr;
+        }
   }
 
   delete[] this->pAvailableDevices;