1. Added a missing #include
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 12 Feb 2009 02:46:10 +0000 (02:46 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 12 Feb 2009 02:46:10 +0000 (02:46 +0000)
2. In jsonNewIterator(): initialize hashItr to NULL
if the object is not a JSON_HASH

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1659 9efc2488-bf62-4759-914b-345cdb29e865

src/libopensrf/osrf_json_object.c

index 486ad2f..8a476be 100644 (file)
@@ -20,6 +20,7 @@ GNU General Public License for more details.
 #include <opensrf/log.h>
 #include <opensrf/osrf_json.h>
 #include <opensrf/osrf_json_utils.h>
+#include <opensrf/osrf_utf8.h>
 
 /* cleans up an object if it is morphing another object, also
  * verifies that the appropriate storage container exists where appropriate */
@@ -382,12 +383,14 @@ jsonIterator* jsonNewIterator(const jsonObject* obj) {
        jsonIterator* itr;
        OSRF_MALLOC(itr, sizeof(jsonIterator));
 
-       itr->obj                = (jsonObject*) obj;
-       itr->index      = 0;
-       itr->key                = NULL;
+       itr->obj    = (jsonObject*) obj;
+       itr->index  = 0;
+       itr->key    = NULL;
 
        if( obj->type == JSON_HASH )
                itr->hashItr = osrfNewHashIterator(obj->value.h);
+       else
+               itr->hashItr = NULL;
        
        return itr;
 }