diff Engine/Graphics/Render.cpp @ 2560:44d9df75dc13

Слияние
author Ritor1
date Thu, 14 May 2015 19:16:21 +0600
parents 6ab1273bc507 67d837007a4c
children 98057834c9a0
line wrap: on
line diff
--- a/Engine/Graphics/Render.cpp	Thu May 14 19:16:08 2015 +0600
+++ b/Engine/Graphics/Render.cpp	Thu May 14 19:16:21 2015 +0600
@@ -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;