1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Fix /plugins reload error message

`/plugins reload non-existent-plugin` printed:
```
Failed to reload plugin: non-existent-plugin, `:^C
```

There were two mistakes:
error_message instead of error_message->str was passed to cons_show().

And in case of failing to unload the plugin due to not finding it in the
hash table it didn't print an error.

This bug was introduced in cc697de05.
This commit is contained in:
Michael Vetter 2023-10-19 12:58:19 +02:00
parent 3bd50fdd6a
commit 2ab9a306ab
2 changed files with 4 additions and 1 deletions

View File

@ -7197,7 +7197,7 @@ cmd_plugins_reload(ProfWin* window, const char* const command, gchar** args)
if (res) {
cons_show("Reloaded plugin: %s", args[1]);
} else {
cons_show("Failed to reload plugin: %s, %s", args[1], error_message);
cons_show("Failed to reload plugin: %s, %s.", args[1], error_message->str);
}
g_string_free(error_message, TRUE);

View File

@ -354,6 +354,9 @@ plugins_reload(const char* const name, GString* error_message)
gboolean res = plugins_unload(name);
if (res) {
res = plugins_load(name, error_message);
} else {
log_info("Failed to reload plugin: %s, not loaded", name);
g_string_assign(error_message, "cannot unload");
}
return res;