Tweak to reflect a better understanding of oilsUtilsQuickReq().
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 23 Mar 2010 13:47:06 +0000 (13:47 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 23 Mar 2010 13:47:06 +0000 (13:47 +0000)
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

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15936 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index bc5a440..27b6455 100644 (file)
@@ -461,7 +461,7 @@ int oilsAuthComplete( osrfMethodContext* ctx ) {
                        "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 @@ int oilsAuthComplete( osrfMethodContext* ctx ) {
                        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;
+                       }
                }
        }