From ec825d0e81d97020783376af3a05a441d4460712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kondor=20D=C3=A1niel?= Date: Sun, 12 Jan 2025 15:59:49 +0100 Subject: [PATCH] plugin-loader: refuse loading plugins with no metadata This can happen e.g. if a plugin was installed after Wayfire was started (and thus wf-config did not update its metadata), or if a metadata file is not installed correctly. This avoids a crash later when the plugin tries to load its configuration. --- src/core/plugin-loader.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/plugin-loader.cpp b/src/core/plugin-loader.cpp index 76f8b0d5d..edff38154 100644 --- a/src/core/plugin-loader.cpp +++ b/src/core/plugin-loader.cpp @@ -168,6 +168,19 @@ void wf::plugin_manager_t::reload_dynamic_plugins() continue; } + auto config_section = wf::get_core().config.get_section(plugin_name); + if (config_section == nullptr) + { + LOGE(plugin_name, + " has no configuration, skipping. " + "Usual reasons for this include missing or outdated plugin XML files, " + "or mismatch between the versions of Wayfire and wf-config. " + "Make sure that you have the correct versions of all relevant packages and make sure that there ", + "are no conflicting installations of Wayfire using the same prefix. " + "Note that if this plugin was newly installed, you need to restart Wayfire before using it."); + continue; + } + next_plugins.push_back(plugin_path.value()); } else {