[gnome-builder/wip/libide-merge] clang: be defensive when creating diagnostics
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge] clang: be defensive when creating diagnostics
- Date: Mon, 23 Mar 2015 09:23:11 +0000 (UTC)
commit 5eeff9f9df1521aaf3ee3e26e25f26720c60ce6f
Author: Christian Hergert <christian hergert me>
Date: Mon Mar 23 02:22:57 2015 -0700
clang: be defensive when creating diagnostics
libide/clang/ide-clang-translation-unit.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libide/clang/ide-clang-translation-unit.c b/libide/clang/ide-clang-translation-unit.c
index 3188afe..3e09fdf 100644
--- a/libide/clang/ide-clang-translation-unit.c
+++ b/libide/clang/ide-clang-translation-unit.c
@@ -218,7 +218,7 @@ create_range (IdeClangTranslationUnit *self,
const gchar *workpath,
CXSourceRange cxrange)
{
- IdeSourceRange *range;
+ IdeSourceRange *range = NULL;
CXSourceLocation cxbegin;
CXSourceLocation cxend;
g_autoptr(IdeSourceLocation) begin = NULL;
@@ -232,7 +232,8 @@ create_range (IdeClangTranslationUnit *self,
begin = create_location (self, project, workpath, cxbegin);
end = create_location (self, project, workpath, cxend);
- range = _ide_source_range_new (begin, end);
+ if ((begin != NULL) && (end != NULL))
+ range = _ide_source_range_new (begin, end);
return range;
}
@@ -302,7 +303,8 @@ create_diagnostic (IdeClangTranslationUnit *self,
cxrange = clang_getDiagnosticRange (cxdiag, i);
range = create_range (self, project, workpath, cxrange);
- _ide_diagnostic_take_range (diag, range);
+ if (range != NULL)
+ _ide_diagnostic_take_range (diag, range);
}
return diag;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]