From 9ec1a475d2ad0ea53361dda40465aa7c782a1836 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 8 Apr 2014 16:58:13 +0100 Subject: [PATCH] Fixed the AST converter code to deal with null values correctly. --- src/Core/Parser/ASTConverter.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Core/Parser/ASTConverter.cs b/src/Core/Parser/ASTConverter.cs index 5d875875..72675e6b 100644 --- a/src/Core/Parser/ASTConverter.cs +++ b/src/Core/Parser/ASTConverter.cs @@ -30,7 +30,7 @@ namespace CppSharp public TRet Visit(Parser.AST.Type type) { - if (type.__Instance == IntPtr.Zero) + if (type == null) return default(TRet); switch (type.Kind) @@ -563,7 +563,7 @@ namespace CppSharp public override AST.Declaration Visit(Parser.AST.Declaration decl) { - if (decl.__Instance == IntPtr.Zero) + if (decl == null) return null; if (decl.OriginalPtr == null) @@ -1045,7 +1045,8 @@ namespace CppSharp _class.HasNonTrivialDestructor = @class.HasNonTrivialDestructor; _class.IsExternCContext = @class.IsExternCContext; - _class.Layout = VisitClassLayout(@class.Layout); + if (@class.Layout != null) + _class.Layout = VisitClassLayout(@class.Layout); } public override AST.Declaration VisitClass(Class @class)