From 886b90f3d09e9c585d4eeab10e7b22f01e917cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 11 Jun 2006 14:08:10 +0000 Subject: [PATCH] Fixed a segfault in document_find_by_filename(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@431 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 1 + src/document.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7320c59e..ae7fe08b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ * src/highlighting.c: Replaced "/" by G_DIR_SEPARATOR_S. * src/utils.c: Fixed an issue, which let the build menu item insensitive once a new file w/o template was opened. + * src/document.c: Fixed a segfault in document_find_by_filename(). 2006-06-10 Enrico Troeger diff --git a/src/document.c b/src/document.c index e3817503..14393605 100644 --- a/src/document.c +++ b/src/document.c @@ -65,8 +65,8 @@ gint document_find_by_filename(const gchar *filename, gboolean is_tm_filename) for(i = 0; i < GEANY_MAX_OPEN_FILES; i++) { - gchar *dl_fname = (is_tm_filename) ? doc_list[i].tm_file->file_name : - doc_list[i].file_name; + gchar *dl_fname = (is_tm_filename && doc_list[i].tm_file) ? + doc_list[i].tm_file->file_name : doc_list[i].file_name; #ifdef GEANY_WIN32 // ignore the case of filenames and paths under WIN32, causes errors if not if (dl_fname && ! strcasecmp(dl_fname, filename)) return i;