From e1e038918f328c317e688e9223150b455bd91e63 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Thu, 25 Oct 2018 23:29:43 +0200 Subject: [PATCH] Fix some code indentation. --- src/normal.c | 12 +++++++----- src/util.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/normal.c b/src/normal.c index 4044409..0efc0b1 100644 --- a/src/normal.c +++ b/src/normal.c @@ -751,7 +751,7 @@ static VbResult normal_view_source(Client *c, const NormalCmdInfo *info) } webkit_web_resource_get_data(resource, NULL, - (GAsyncReadyCallback)normal_view_source_loaded, c); + (GAsyncReadyCallback)normal_view_source_loaded, c); return RESULT_COMPLETE; } @@ -764,10 +764,12 @@ static void normal_view_source_loaded(WebKitWebResource *resource, char *text = NULL; data = webkit_web_resource_get_data_finish(resource, res, &length, NULL); - text = g_strndup(data, length); - command_spawn_editor(c, &((Arg){0, (char *)text}), NULL, NULL); - g_free(data); - g_free(text); + if (data) { + text = g_strndup(data, length); + command_spawn_editor(c, &((Arg){0, (char *)text}), NULL, NULL); + g_free(data); + g_free(text); + } } static VbResult normal_yank(Client *c, const NormalCmdInfo *info) diff --git a/src/util.c b/src/util.c index 0255e54..e22bb1d 100644 --- a/src/util.c +++ b/src/util.c @@ -134,8 +134,8 @@ gboolean util_create_tmp_file(const char *content, char **file) } if (content == NULL) { - close(fp); - return TRUE; + close(fp); + return TRUE; } len = strlen(content); -- 2.20.1