- Add check on null-pointer. Fixes exception in some cases
authorDmitry Chapyshev <dmitry@reactos.org>
Fri, 17 Apr 2009 07:12:21 +0000 (07:12 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Fri, 17 Apr 2009 07:12:21 +0000 (07:12 +0000)
svn path=/trunk/; revision=40555

reactos/lib/rtl/critical.c

index 884a45c..7367c5e 100644 (file)
@@ -117,12 +117,15 @@ RtlpWaitForCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
     DPRINT("Waiting on Critical Section Event: %p %p\n",
             CriticalSection,
             CriticalSection->LockSemaphore);
-    CriticalSection->DebugInfo->EntryCount++;
+
+    if (CriticalSection->DebugInfo)
+        CriticalSection->DebugInfo->EntryCount++;
 
     for (;;) {
 
         /* Increase the number of times we've had contention */
-        CriticalSection->DebugInfo->ContentionCount++;
+        if (CriticalSection->DebugInfo)
+            CriticalSection->DebugInfo->ContentionCount++;
 
         /* Wait on the Event */
         Status = NtWaitForSingleObject(CriticalSection->LockSemaphore,