Prevent crash when non-advertised Class omits Context. Fixes #5651.
Bob Arnson committed
Aug 22, 2018 at 19:49 UTC
377cf89824f11150c3caa41adb09fb2f6f3df633
1 file changed
+18
-15
src/WixToolset.Core/Compiler.cs
+18
-15
@@ -1097,24 +1097,27 @@ namespace WixToolset.Core
1097
}
1098
1099
HashSet<string> uniqueContexts = new HashSet<string>();
1100
- foreach (string context in contexts)
1100
+ if (contexts != null)
1101
{
1102
- if (uniqueContexts.Contains(context))
1103
- {
1104
- this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1105
- }
1106
- else
1102
+ foreach (string context in contexts)
1103
{
1108
- uniqueContexts.Add(context);
1109
- }
1104
+ if (uniqueContexts.Contains(context))
1105
+ {
1106
+ this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1107
+ }
1108
+ else
1109
+ {
1110
+ uniqueContexts.Add(context);
1111
+ }
1112
1111
- if (context.EndsWith("32", StringComparison.Ordinal))
1112
- {
1113
- class32bit = true;
1114
- }
1115
- else
1116
- {
1117
- class16bit = true;
1113
+ if (context.EndsWith("32", StringComparison.Ordinal))
1114
+ {
1115
+ class32bit = true;
1116
+ }
1117
+ else
1118
+ {
1119
+ class16bit = true;
1120
+ }
1121
}
1122
}
1123