From 289e2cb951a5fba9ba8c9e36c30f5e5a566badbd Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 13 Aug 2010 17:00:36 +0000 Subject: [PATCH] Fix segfault on Tools->Reload Configuration when no documents are open (#3037079). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/Geany-0_19_1@5161 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ NEWS | 2 ++ src/filetypes.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c1dedcaa1..f0c2b16d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * win32-config.h, geany.nsi, configure.ac, doc/geany.txt, doc/geany.html, wscript, geany_private.rc: Version bump. + * src/filetypes.c, NEWS: + Fix segfault on Tools->Reload Configuration when no documents are + open (#3037079). 2010-08-12 Nick Treleaven diff --git a/NEWS b/NEWS index 31be849a4..71dce5a55 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ Geany 0.19.1 (TBA) document name for menu items (#3038844). * File Browser: Allow Find in Files when no items are selected. * Fix build menu translation problems. + * Fix segfault on Tools->Reload Configuration when no documents are + open (#3037079). * Fix a memory leak (thanks to Daniel Marjamäki). * Use g_free instead of free (patch by Daniel Marjamäki, thanks). diff --git a/src/filetypes.c b/src/filetypes.c index 09b65e10a..94d504a0f 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -1659,8 +1659,12 @@ void filetypes_reload(void) /* filetypes_load_config() will skip not loaded filetypes */ filetypes_load_config(i, TRUE); } - /* update document styling */ + current_doc = document_get_current(); + if (!current_doc) + return; + + /* update document styling */ foreach_document(i) { if (current_doc != documents[i]) -- 2.11.4.GIT