From: pk910 Date: Sat, 18 Feb 2012 18:46:15 +0000 (+0100) Subject: added error message if modules block is missing in configuration X-Git-Tag: v5.4~40 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=ff689d90ad836cbbb3f1b773618ce249377bc631 added error message if modules block is missing in configuration --- diff --git a/src/main.c b/src/main.c index fa8aee1..1287faf 100644 --- a/src/main.c +++ b/src/main.c @@ -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. */ diff --git a/src/modules.c b/src/modules.c index d024c3e..ba3a43a 100644 --- a/src/modules.c +++ b/src/modules.c @@ -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(); }