Browse Source

MDLImporter: Don't take address of packed struct member

Turo Lamminen 7 years ago
parent
commit
bcffa28a33
1 changed files with 3 additions and 1 deletions
  1. 3 1
      code/MDLMaterialLoader.cpp

+ 3 - 1
code/MDLMaterialLoader.cpp

@@ -665,7 +665,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
         if (0.0f != pcMatIn->Power)
         {
             iShadingMode = (int)aiShadingMode_Phong;
-            pcMatOut->AddProperty<float>(&pcMatIn->Power,1,AI_MATKEY_SHININESS);
+            // pcMatIn is packed, we can't form pointers to its members
+            float power = pcMatIn->Power;
+            pcMatOut->AddProperty<float>(&power,1,AI_MATKEY_SHININESS);
         }
         pcMatOut->AddProperty<int>(&iShadingMode,1,AI_MATKEY_SHADING_MODEL);
     }