[core] fix crash if invalid config file (fixes #2798)