[open-ils-commits] r11548 - trunk/Open-ILS/src/c-apps
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Dec 14 16:50:52 EST 2008
Author: miker
Date: 2008-12-14 16:50:48 -0500 (Sun, 14 Dec 2008)
New Revision: 11548
Modified:
trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
checking for a foreign context first
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2008-12-14 21:43:51 UTC (rev 11547)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2008-12-14 21:50:48 UTC (rev 11548)
@@ -891,48 +891,53 @@
}
}
- if (foreign_context->size > 0) {
- osrfStringArray* class_list = osrfHashKeys( foreign_context );
+ osrfStringArray* class_list;
- int i = 0;
- char* class_name = NULL;
- while ( (class_name = osrfStringArrayGetString(class_list, i++)) ) {
- osrfHash* fcontext = osrfHashGet(foreign_context, class_name);
+ if (foreign_context) {
+ class_list = osrfHashKeys( foreign_context );
- jsonObject* _tmp_params = jsonParseStringFmt(
- "{\"%s\":\"%s\"}",
- osrfHashGet(fcontext, "field"),
- oilsFMGetString(param, osrfHashGet(fcontext, "fkey"))
- );
-
- jsonObject* _list = doFieldmapperSearch(
- ctx,
- class,
- _tmp_params,
- &err
- );
+ if (class_list->size > 0) {
+
+ int i = 0;
+ char* class_name = NULL;
+ while ( (class_name = osrfStringArrayGetString(class_list, i++)) ) {
+ osrfHash* fcontext = osrfHashGet(foreign_context, class_name);
+
+ jsonObject* _tmp_params = jsonParseStringFmt(
+ "{\"%s\":\"%s\"}",
+ osrfHashGet(fcontext, "field"),
+ oilsFMGetString(param, osrfHashGet(fcontext, "fkey"))
+ );
+
+ jsonObject* _list = doFieldmapperSearch(
+ ctx,
+ class,
+ _tmp_params,
+ &err
+ );
+
+
+ jsonObject* _fparam = jsonObjectGetIndex(_list, 0);
+
+ if (!_fparam) {
+ jsonObjectFree(_tmp_params);
+ jsonObjectFree(_list);
+ return 0;
+ }
-
- jsonObject* _fparam = jsonObjectGetIndex(_list, 0);
-
- if (!_fparam) {
jsonObjectFree(_tmp_params);
jsonObjectFree(_list);
- return 0;
+
+ char* foreign_field = NULL;
+ while ( (foreign_field = osrfStringArrayGetString(osrfHashGet(fcontext,"context"), i++)) ) {
+ osrfStringArrayAdd( context_org_array, oilsFMGetString( _fparam, foreign_field ) );
+ }
+
+ jsonObjectFree(_fparam);
}
- jsonObjectFree(_tmp_params);
- jsonObjectFree(_list);
-
- char* foreign_field = NULL;
- while ( (foreign_field = osrfStringArrayGetString(osrfHashGet(fcontext,"context"), i++)) ) {
- osrfStringArrayAdd( context_org_array, oilsFMGetString( _fparam, foreign_field ) );
- }
-
- jsonObjectFree(_fparam);
+ osrfStringArrayFree(class_list);
}
-
- osrfStringArrayFree(class_list);
}
jsonObjectFree(param);
More information about the open-ils-commits
mailing list