Skip to content

Commit

Permalink
Fix some warnings when using gopls
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed May 27, 2024
1 parent 178d7fd commit 5315ffd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lsp/src/lsp-code-lens.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void code_lens_cb(GVariant *return_value, GError *error, gpointer user_da

srv = doc_exists ? lsp_server_get(doc) : NULL;

if (!error && srv)
if (!error && srv && g_variant_is_of_type(return_value, G_VARIANT_TYPE_ARRAY))
{
GVariant *code_action = NULL;
gint last_line = 0;
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/lsp-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void lsp_command_send_request(LspServer *server, const gchar *cmd, GVariant *arg

static void code_action_cb(GVariant *return_value, GError *error, gpointer user_data)
{
if (!error)
if (!error && g_variant_is_of_type(return_value, G_VARIANT_TYPE_ARRAY))
{
GCallback callback = user_data;
GVariant *code_action = NULL;
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/lsp-goto.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void show_in_msgwin(LspLocation *loc, GHashTable *sci_table)
gchar *rel_path = lsp_utils_get_relative_path(base_path, fname);
gchar *locale_base_path = utils_get_locale_from_utf8(base_path);

if (!g_str_has_prefix(rel_path, ".."))
if (rel_path && !g_str_has_prefix(rel_path, ".."))
SETPTR(fname, g_strdup(rel_path));

msgwin_set_messages_dir(locale_base_path);
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/lsp-symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static void workspace_symbols_cb(GVariant *return_value, GError *error, gpointer
LspWorkspaceSymbolUserData *data = user_data;
GPtrArray *ret = g_ptr_array_new_full(0, (GDestroyNotify)lsp_symbol_free);

if (!error)
if (!error && g_variant_is_of_type(return_value, G_VARIANT_TYPE_ARRAY))
{
//printf("%s\n\n\n", lsp_utils_json_pretty_print(return_value));

Expand Down

0 comments on commit 5315ffd

Please sign in to comment.