From 6f195b18fc03ae35198100871403908fbe4fb20f Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Fri, 18 Aug 2017 20:37:45 -0400 Subject: [PATCH] WINGs: WMIsPL* functions return False if proplist is null. Previously, calls to WMIsPLString, WMIsPLData, WMIsPLArray, and WMIsPLDictionary would result in a segfault if the argument was null. This could happen, e.g., if we are checking which type of proplist was just parsed from a file, but the parsing failed. These functions now return False in this case. --- WINGs/proplist.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/WINGs/proplist.c b/WINGs/proplist.c index 5f68eace..55188964 100644 --- a/WINGs/proplist.c +++ b/WINGs/proplist.c @@ -1253,22 +1253,34 @@ int WMGetPropListItemCount(WMPropList * plist) Bool WMIsPLString(WMPropList * plist) { - return (plist->type == WPLString); + if (plist) + return (plist->type == WPLString); + else + return False; } Bool WMIsPLData(WMPropList * plist) { - return (plist->type == WPLData); + if (plist) + return (plist->type == WPLData); + else + return False; } Bool WMIsPLArray(WMPropList * plist) { - return (plist->type == WPLArray); + if (plist) + return (plist->type == WPLArray); + else + return False; } Bool WMIsPLDictionary(WMPropList * plist) { - return (plist->type == WPLDictionary); + if (plist) + return (plist->type == WPLDictionary); + else + return False; } Bool WMIsPropListEqualTo(WMPropList * plist, WMPropList * other)