Skip to content

Commit 0229784

Browse files
csyonghejsmall-zzz
andauthored
Fix language server crash when processing predefind macros. (shader-slang#2302)
Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
1 parent 50b4425 commit 0229784

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/slang/slang-workspace-version.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ bool Workspace::updatePredefinedMacros(List<String> macros)
7575
{
7676
auto index = macro.indexOf('=');
7777
OwnedPreprocessorMacroDefinition def;
78-
def.name = macro.getUnownedSlice().head(index).trim();
7978
if (index != -1)
8079
{
80+
def.name = macro.getUnownedSlice().head(index).trim();
8181
def.value = macro.getUnownedSlice().tail(index + 1).trim();
8282
}
83+
else
84+
{
85+
def.name = macro.trim();
86+
}
8387
newDefs.add(def);
8488
}
8589

0 commit comments

Comments
 (0)