[gnome-builder/wip/libide] libide: add more stringent check when creating location
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide] libide: add more stringent check when creating location
- Date: Mon, 2 Mar 2015 07:38:48 +0000 (UTC)
commit fff8025ceb58e8d09e425d36914deb5b6c268a96
Author: Christian Hergert <christian hergert me>
Date: Sun Mar 1 23:38:02 2015 -0800
libide: add more stringent check when creating location
libide/clang/ide-clang-translation-unit.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/libide/clang/ide-clang-translation-unit.c b/libide/clang/ide-clang-translation-unit.c
index ca1550a..29beb37 100644
--- a/libide/clang/ide-clang-translation-unit.c
+++ b/libide/clang/ide-clang-translation-unit.c
@@ -147,12 +147,14 @@ create_location (IdeClangTranslationUnit *self,
IdeFile *file = NULL;
CXFile cxfile = NULL;
g_autofree gchar *path = NULL;
+ const gchar *cstr;
CXString str;
unsigned line;
unsigned column;
unsigned offset;
g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (workpath, NULL);
clang_getFileLocation (cxloc, &cxfile, &line, &column, &offset);
@@ -160,7 +162,11 @@ create_location (IdeClangTranslationUnit *self,
if (column > 0) column--;
str = clang_getFileName (cxfile);
- path = get_path (workpath, clang_getCString (str));
+ cstr = clang_getCString (str);
+ if (!cstr)
+ return NULL;
+
+ path = get_path (workpath, cstr);
clang_disposeString (str);
file = ide_project_get_file_for_path (project, path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]