summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-24 23:07:01 +0200
committerraveit65 <[email protected]>2020-08-26 11:48:33 +0200
commitf64f6566280e408adff0014fa07c3f6c321fa8c2 (patch)
tree820c4cfb343dbc2fd5a226d1534c1a72c017bdfe
parenta4b7d7fad80eec38234833f0ad900eb02445d355 (diff)
downloadpluma-f64f6566280e408adff0014fa07c3f6c321fa8c2.tar.bz2
pluma-f64f6566280e408adff0014fa07c3f6c321fa8c2.tar.xz
pluma-document: Fix warning assertion 'G_IS_FILE (file)' failed
-rw-r--r--pluma/pluma-document.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 49a9dad9..742b7c92 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -713,12 +713,17 @@ set_language (PlumaDocument *doc,
if (g_strrstr (bom_langs, gtk_source_language_get_id (lang)))
{
GFile *file;
+
file = pluma_document_get_location (doc);
+ if (file)
+ {
+ if (!file_with_bom (file))
+ gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
- if (!file_with_bom (file))
+ g_object_unref (file);
+ }
+ else
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
-
- g_object_unref (file);
}
else
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);