[valadoc] libvaladoc: TypeReference: Add missing null checks



commit 7829d666d5d9e3466fd8ab096206400170863e4f
Author: Florian Brosch <flo brosch gmail com>
Date:   Thu Feb 24 03:32:43 2011 +0100

    libvaladoc: TypeReference: Add missing null checks

 src/libvaladoc/api/typereference.vala |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/libvaladoc/api/typereference.vala b/src/libvaladoc/api/typereference.vala
index 8b7428b..e7adfe8 100644
--- a/src/libvaladoc/api/typereference.vala
+++ b/src/libvaladoc/api/typereference.vala
@@ -51,6 +51,10 @@ public class Valadoc.Api.TypeReference : Item {
 
 	public bool pass_ownership {
 		get {
+			if (this.vtyperef == null) {
+				return false;
+			}
+
 			Vala.CodeNode? node = this.vtyperef.parent_node;
 			if (node == null) {
 				return false;
@@ -69,6 +73,10 @@ public class Valadoc.Api.TypeReference : Item {
 
 	public bool is_owned {
 		get {
+			if (this.vtyperef == null) {
+				return false;
+			}
+
 			Vala.CodeNode parent = this.vtyperef.parent_node;
 
 			// parameter:
@@ -101,7 +109,7 @@ public class Valadoc.Api.TypeReference : Item {
 
 	public bool is_dynamic {
 		get {
-			return this.vtyperef.is_dynamic;
+			return this.vtyperef != null && this.vtyperef.is_dynamic;
 		}
 	}
 
@@ -123,14 +131,19 @@ public class Valadoc.Api.TypeReference : Item {
 
 	public bool is_nullable {
 		get {
-			return this.vtyperef.nullable
+			return this.vtyperef != null
+			       && this.vtyperef.nullable
 			       && !(this.vtyperef is Vala.GenericType)
 			       && !(this.vtyperef is Vala.PointerType);
 		}
 	}
 
 	public string? get_dbus_type_signature () {
-		return Vala.DBusModule.get_type_signature (vtyperef);
+		if (vtyperef != null) {
+			return Vala.DBusModule.get_type_signature (vtyperef);
+		} else {
+			return null;
+		}
 	}
 
 	internal override void resolve_type_references (Tree root) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]