Browse Source

Do not access iterator that may be empty (#2026)

Helena Kotas 6 years ago
parent
commit
368c411ff4
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lib/HLSL/DxilGenerationPass.cpp

+ 4 - 1
lib/HLSL/DxilGenerationPass.cpp

@@ -313,7 +313,10 @@ public:
     // High-level metadata should now be turned into low-level metadata.
     // High-level metadata should now be turned into low-level metadata.
     const bool SkipInit = true;
     const bool SkipInit = true;
     hlsl::DxilModule &DxilMod = M.GetOrCreateDxilModule(SkipInit);
     hlsl::DxilModule &DxilMod = M.GetOrCreateDxilModule(SkipInit);
-    auto pProps = &EntryPropsMap.begin()->second->props;
+    DxilFunctionProps *pProps = nullptr;
+    if (!SM->IsLib()) {
+      pProps = &EntryPropsMap.begin()->second->props;
+    }
     InitDxilModuleFromHLModule(*m_pHLModule, DxilMod, m_HasDbgInfo);
     InitDxilModuleFromHLModule(*m_pHLModule, DxilMod, m_HasDbgInfo);
     DxilMod.ResetEntryPropsMap(std::move(EntryPropsMap));
     DxilMod.ResetEntryPropsMap(std::move(EntryPropsMap));
     if (!SM->IsLib()) {
     if (!SM->IsLib()) {