From 377cf89824f11150c3caa41adb09fb2f6f3df633 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 22 Aug 2018 19:49:07 -0400 Subject: Prevent crash when non-advertised Class omits Context. Fixes #5651. --- src/WixToolset.Core/Compiler.cs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/WixToolset.Core/Compiler.cs') diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 437c1481..a4c289f7 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -1097,24 +1097,27 @@ namespace WixToolset.Core } HashSet uniqueContexts = new HashSet(); - foreach (string context in contexts) + if (contexts != null) { - if (uniqueContexts.Contains(context)) - { - this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context)); - } - else + foreach (string context in contexts) { - uniqueContexts.Add(context); - } + if (uniqueContexts.Contains(context)) + { + this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context)); + } + else + { + uniqueContexts.Add(context); + } - if (context.EndsWith("32", StringComparison.Ordinal)) - { - class32bit = true; - } - else - { - class16bit = true; + if (context.EndsWith("32", StringComparison.Ordinal)) + { + class32bit = true; + } + else + { + class16bit = true; + } } } -- cgit v1.2.3-55-g6feb