added error message if modules block is missing in configuration
authorpk910 <philipp@zoelle1.de>
Sat, 18 Feb 2012 18:46:15 +0000 (19:46 +0100)
committerpk910 <philipp@zoelle1.de>
Sat, 18 Feb 2012 18:46:15 +0000 (19:46 +0100)
src/main.c
src/modules.c

index fa8aee1f8bb24135776721aba6394c41705627b5..1287faf242dcba4c22148ccc945e55931ad570ea 100644 (file)
@@ -216,6 +216,12 @@ int main(int argc, char *argv[]) {
         exit(0);
     }
     check_firstrun();
+    char **modulelist = get_all_fieldnames("modules");
+    if(!modulelist || !modulelist[0]) {
+        fprintf(stderr, "no modules loaded... Please update your configuration!\n");
+        exit(0);
+    }
+    free(modulelist);
     if (run_as_daemon) {
         #ifndef WIN32
         /* Attempt to fork into the background if daemon mode is on. */
index d024c3e186f3abb39bdf80534cf77aa3f16f2d8d..ba3a43a6b8fb32937ad4665bc464d74bb3de053b 100644 (file)
@@ -259,6 +259,7 @@ static void unregister_module_hooks(int module_id);
 
 void loadModules() {
     char **modulelist = get_all_fieldnames("modules");
+    if(!modulelist) return;
     int i = 0;
     char tmp[MAXLEN];
     struct ModuleInfo *modinfo;
@@ -272,6 +273,7 @@ void loadModules() {
         }
         i++;
     }
+    free(modulelist);
     start_modules();
 }