fix: print when no plugins installed

Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
This commit is contained in:
Viachaslau Khalikin
2022-09-20 04:30:11 +03:00
parent d75e5c1c28
commit 0cb46460b3

View File

@@ -7260,7 +7260,14 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args)
} }
} }
GList* plugins = plugins_loaded_list();
GSList* unloaded_plugins = plugins_unloaded_list(); GSList* unloaded_plugins = plugins_unloaded_list();
if (plugins == NULL && unloaded_plugins == NULL) {
cons_show("No plugins installed.");
return TRUE;
}
if (unloaded_plugins) { if (unloaded_plugins) {
GSList* curr = unloaded_plugins; GSList* curr = unloaded_plugins;
cons_show("The following plugins already installed and can be loaded:"); cons_show("The following plugins already installed and can be loaded:");
@@ -7271,12 +7278,7 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args)
g_slist_free_full(unloaded_plugins, g_free); g_slist_free_full(unloaded_plugins, g_free);
} }
GList* plugins = plugins_loaded_list(); if (plugins) {
if (plugins == NULL) {
cons_show("No loaded plugins.");
return TRUE;
}
GList* curr = plugins; GList* curr = plugins;
cons_show("Loaded plugins:"); cons_show("Loaded plugins:");
while (curr) { while (curr) {
@@ -7284,6 +7286,7 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args)
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(plugins); g_list_free(plugins);
}
return TRUE; return TRUE;
} }