Exiting with a usable error message rather than segfaulting
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 29 Apr 2007 20:11:51 +0000 (20:11 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 29 Apr 2007 20:11:51 +0000 (20:11 +0000)
 - patch provided by Scott McKellar
 - http://list.georgialibraries.org/pipermail/open-ils-dev/2007-April/000727.html

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

src/libstack/osrf_settings.c

index 96127d9..fa8d98e 100644 (file)
@@ -12,6 +12,14 @@ char* osrf_settings_host_value(char* format, ...) {
 
 jsonObject* osrf_settings_host_value_object(char* format, ...) {
        VA_LIST_TO_STRING(format);
+
+       if( ! config ) {
+               const char * msg = "config pointer is NULL";
+               fprintf( stderr, "osrf_settings_host_value_object: %s\n", msg );
+               osrfLogError( OSRF_LOG_MARK, msg );
+               exit( 99 );
+       }
+
        return jsonObjectFindPath(config->config, VA_BUF);
 }