]> git.saurik.com Git - wxWidgets.git/commitdiff
fix null-pointer crash
authorRyan Norton <wxprojects@comcast.net>
Mon, 14 Feb 2005 23:00:27 +0000 (23:00 +0000)
committerRyan Norton <wxprojects@comcast.net>
Mon, 14 Feb 2005 23:00:27 +0000 (23:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/corefoundation/hid.cpp

index 75eec3cbc1f30093be8835bd6064f470bbb0c54a..16c956b2077fb47163a885a74a7967541db7264d 100644 (file)
@@ -152,15 +152,19 @@ USB Product Name
                //Get [product] name
                m_szProductName = wxMacCFStringHolder( (CFStringRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey)), false ).AsString();
         
                //Get [product] name
                m_szProductName = wxMacCFStringHolder( (CFStringRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey)), false ).AsString();
         
-       CFNumberGetValue(
-                               (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductIDKey)),     
+        CFNumberRef nref = (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductIDKey));
+        
+        if (nref)
+        CFNumberGetValue(
+                               nref,   
                                kCFNumberIntType,
                 &m_nProductId
                                );
 
                                kCFNumberIntType,
                 &m_nProductId
                                );
 
-
+        nref = (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey));
+        if (nref)
        CFNumberGetValue(
        CFNumberGetValue(
-                               (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey)),      
+                               nref,   
                                kCFNumberIntType,
                 &m_nManufacturerId
                                );
                                kCFNumberIntType,
                 &m_nManufacturerId
                                );