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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user