From b1c5cb3bf315c9433a815444c4b272a29aafab77 Mon Sep 17 00:00:00 2001 From: Elias Holzer Date: Thu, 8 May 2014 18:57:00 +0200 Subject: [PATCH] Fixed crash when file path of a unit was invalid. --- src/Generator/Generator.cs | 2 +- src/Generator/Passes/CleanUnitPass.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Generator/Generator.cs b/src/Generator/Generator.cs index 1606cc2a..436c8909 100644 --- a/src/Generator/Generator.cs +++ b/src/Generator/Generator.cs @@ -71,7 +71,7 @@ namespace CppSharp.Generators if (!unit.IsGenerated || !unit.HasDeclarations) continue; - if (unit.IsSystemHeader) + if (unit.IsSystemHeader || !unit.IsValid) continue; var templates = Generate(unit); diff --git a/src/Generator/Passes/CleanUnitPass.cs b/src/Generator/Passes/CleanUnitPass.cs index 9e933183..2d3628ba 100644 --- a/src/Generator/Passes/CleanUnitPass.cs +++ b/src/Generator/Passes/CleanUnitPass.cs @@ -18,9 +18,12 @@ namespace CppSharp.Passes // Try to get an include path that works from the original include // directories paths. - - unit.IncludePath = GetIncludePath(unit.FilePath); - return true; + if (unit.IsValid) + { + unit.IncludePath = GetIncludePath(unit.FilePath); + return true; + } + return false; } string GetIncludePath(string filePath)