[open-ils-commits] r15936 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 23 09:47:08 EDT 2010


Author: scottmk
Date: 2010-03-23 09:47:06 -0400 (Tue, 23 Mar 2010)
New Revision: 15936

Modified:
   trunk/Open-ILS/src/c-apps/oils_auth.c
Log:
Tweak to reflect a better understanding of oilsUtilsQuickReq().
If the latter calls a method that returns no result, it returns
a JSON_NULL, not a NULL.

(The previous version worked correctly, but kinda sorta by accident.)

M    Open-ILS/src/c-apps/oils_auth.c


Modified: trunk/Open-ILS/src/c-apps/oils_auth.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_auth.c	2010-03-22 22:25:41 UTC (rev 15935)
+++ trunk/Open-ILS/src/c-apps/oils_auth.c	2010-03-23 13:47:06 UTC (rev 15936)
@@ -461,7 +461,7 @@
 			"open-ils.cstore", "open-ils.cstore.direct.actor.card.search", params );
 		jsonObjectFree( params );
 
-		if( card ) {
+		if( card && card->type != JSON_NULL ) {
 			// Determine whether the card is active
 			char* card_active_str = oilsFMGetString( card, "active" );
 			card_active = oilsUtilsIsDBTrue( card_active_str );
@@ -475,6 +475,11 @@
 			userObj = oilsUtilsQuickReq(
 					"open-ils.cstore", "open-ils.cstore.direct.actor.user.retrieve", params );
 			jsonObjectFree( params );
+			if( userObj && JSON_NULL == userObj->type ) {
+				// user not found (shouldn't happen, due to foreign key)
+				jsonObjectFree( userObj );
+				userObj = NULL;
+			}
 		}
 	}
 



More information about the open-ils-commits mailing list