[vala] girparser: Fix criticals when enums or error domains have no children



commit edc3d3b7409ee486aec7f4aa8393214a952bc379
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun May 29 21:50:06 2011 +0200

    girparser: Fix criticals when enums or error domains have no children

 vala/valagirparser.vala |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 0140f6e..bd85b41 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1785,11 +1785,19 @@ public class Vala.GirParser : CodeVisitor {
 
 		if (cname != null) {
 			if (sym is Enum) {
-				((Enum) sym).set_cname (cname);
-				((Enum) sym).set_cprefix (common_prefix);
+				if (cname != null) {
+					((Enum) sym).set_cname (cname);
+				}
+				if (common_prefix != null) {
+					((Enum) sym).set_cprefix (common_prefix);
+				}
 			} else {
-				((ErrorDomain) sym).set_cname (cname);
-				((ErrorDomain) sym).set_cprefix (common_prefix);
+				if (cname != null) {
+					((ErrorDomain) sym).set_cname (cname);
+				}
+				if (common_prefix != null) {
+					((ErrorDomain) sym).set_cprefix (common_prefix);
+				}
 			}
 		}
 



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