@@ -751,7 +751,7 @@ static bool ReadFacesListChunks(FileInfo * info, Object object)
751
751
count = ReadWORD (info->f );
752
752
strcat (matName, name);
753
753
754
- mat = displaySystem.GetMaterial (matName);
754
+ mat = displaySystem ? displaySystem .GetMaterial (matName) : null ;
755
755
faces = info->matFaces [(uintptr )mat];
756
756
if (!faces)
757
757
info->matFaces [(uintptr )mat] = faces = { };
@@ -856,7 +856,7 @@ static bool ReadTriMesh(FileInfo * info, Object object)
856
856
{
857
857
Material mat = (Material)&m;
858
858
Array<int > faces = m;
859
- if (mat.flags .translucent )
859
+ if (mat && mat .flags .translucent )
860
860
{
861
861
mesh.primitives = renew mesh.primitives PrimitiveSingle[mesh.nPrimitives + faces.count ];
862
862
for (i : faces)
@@ -1170,17 +1170,17 @@ static bool ReadMap(FileInfo * info, Material mat)
1170
1170
bool translucent = false ;
1171
1171
if (!mat.baseMap )
1172
1172
{
1173
- mat.baseMap = displaySystem.GetTexture (location);
1173
+ mat.baseMap = displaySystem ? displaySystem .GetTexture (location) : null ;
1174
1174
if (!mat.baseMap )
1175
1175
{
1176
1176
mat.baseMap = Bitmap { };
1177
- if (displaySystem.GetTexture (bumpName))
1177
+ if (displaySystem && displaySystem .GetTexture (bumpName))
1178
1178
{
1179
1179
mat.bumpMap = null ; // Bad bump map if it's the same as the diffuse map...
1180
1180
}
1181
1181
if (!mat.baseMap .Load (location, null , null ) ||
1182
1182
!mat.baseMap .Convert (null , pixelFormat888, null ) ||
1183
- !displaySystem.AddTexture (location, mat.baseMap ))
1183
+ (displaySystem && !displaySystem.AddTexture (location, mat.baseMap ) ))
1184
1184
{
1185
1185
delete mat.baseMap ;
1186
1186
}
@@ -1593,7 +1593,7 @@ static bool ReadEditChunks(FileInfo * info, void * data)
1593
1593
Material mat;
1594
1594
ReadChunks (ReadMaterial, info, material);
1595
1595
1596
- mat = info->displaySystem .AddNamedMaterial (material.name );
1596
+ mat = info->displaySystem ? info-> displaySystem .AddNamedMaterial (material.name ) : { } ;
1597
1597
if (mat)
1598
1598
{
1599
1599
if (material.baseMap )
0 commit comments