Skip to content

Commit

Permalink
Fix /plugins reload error message
Browse files Browse the repository at this point in the history
`/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 cc697de.
  • Loading branch information
jubalh committed Oct 19, 2023
1 parent 3bd50fd commit 2ab9a30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/command/cmd_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2ab9a30

Please sign in to comment.