aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
authorBob Arnson <bob@joyofsetup.com>2018-08-22 19:49:07 -0400
committerRob Mensching <rob@robmensching.com>2018-08-23 10:11:36 -0700
commit377cf89824f11150c3caa41adb09fb2f6f3df633 (patch)
tree0677354a28a5fb5727a6df0d7d11c68e3511e62e /src/WixToolset.Core
parent2a27f9032aa115bc2f88d9be695d9b049db1a894 (diff)
downloadwix-377cf89824f11150c3caa41adb09fb2f6f3df633.tar.gz
wix-377cf89824f11150c3caa41adb09fb2f6f3df633.tar.bz2
wix-377cf89824f11150c3caa41adb09fb2f6f3df633.zip
Prevent crash when non-advertised Class omits Context. Fixes #5651.
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Compiler.cs33
1 files changed, 18 insertions, 15 deletions
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
1097 } 1097 }
1098 1098
1099 HashSet<string> uniqueContexts = new HashSet<string>(); 1099 HashSet<string> uniqueContexts = new HashSet<string>();
1100 foreach (string context in contexts) 1100 if (contexts != null)
1101 { 1101 {
1102 if (uniqueContexts.Contains(context)) 1102 foreach (string context in contexts)
1103 {
1104 this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1105 }
1106 else
1107 { 1103 {
1108 uniqueContexts.Add(context); 1104 if (uniqueContexts.Contains(context))
1109 } 1105 {
1106 this.Core.Write(ErrorMessages.DuplicateContextValue(sourceLineNumbers, context));
1107 }
1108 else
1109 {
1110 uniqueContexts.Add(context);
1111 }
1110 1112
1111 if (context.EndsWith("32", StringComparison.Ordinal)) 1113 if (context.EndsWith("32", StringComparison.Ordinal))
1112 { 1114 {
1113 class32bit = true; 1115 class32bit = true;
1114 } 1116 }
1115 else 1117 else
1116 { 1118 {
1117 class16bit = true; 1119 class16bit = true;
1120 }
1118 } 1121 }
1119 } 1122 }
1120 1123