From 2ff29ddf87c7935a609306057063d39141130da3 Mon Sep 17 00:00:00 2001 From: Ryan Norton Date: Mon, 14 Feb 2005 23:00:27 +0000 Subject: [PATCH] fix null-pointer crash git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/corefoundation/hid.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mac/corefoundation/hid.cpp b/src/mac/corefoundation/hid.cpp index 75eec3cbc1..16c956b207 100644 --- a/src/mac/corefoundation/hid.cpp +++ b/src/mac/corefoundation/hid.cpp @@ -152,15 +152,19 @@ USB Product Name //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 ); - + nref = (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey)); + if (nref) CFNumberGetValue( - (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey)), + nref, kCFNumberIntType, &m_nManufacturerId ); -- 2.50.0