File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed
Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -133,9 +133,30 @@ std::unique_ptr<MDAL::Mesh> MDAL::DriverXmsTin::load( const std::string &meshFil
133133
134134 Face &face = faces[i];
135135 face.resize ( MAX_VERTICES_PER_FACE_TIN );
136- face[0 ] = MDAL::toSizeT ( chunks[0 ] ) - 1 ;
137- face[1 ] = MDAL::toSizeT ( chunks[1 ] ) - 1 ;
138- face[2 ] = MDAL::toSizeT ( chunks[2 ] ) - 1 ;
136+
137+ const size_t chunk0 = MDAL::toSizeT ( chunks[0 ] );
138+ if ( chunk0 < 1 )
139+ {
140+ MDAL::Log::error ( MDAL_Status::Err_IncompatibleMesh, name (), meshFile + " does not contain valid triangle definition (first chunk value is < 1)" );
141+ return nullptr ;
142+ }
143+ face[0 ] = chunk0 - 1 ;
144+
145+ const size_t chunk1 = MDAL::toSizeT ( chunks[1 ] );
146+ if ( chunk1 < 1 )
147+ {
148+ MDAL::Log::error ( MDAL_Status::Err_IncompatibleMesh, name (), meshFile + " does not contain valid triangle definition (second chunk value is < 1)" );
149+ return nullptr ;
150+ }
151+ face[1 ] = chunk1 - 1 ;
152+
153+ const size_t chunk2 = MDAL::toSizeT ( chunks[2 ] );
154+ if ( chunk2 < 1 )
155+ {
156+ MDAL::Log::error ( MDAL_Status::Err_IncompatibleMesh, name (), meshFile + " does not contain valid triangle definition (third chunk value is < 1)" );
157+ return nullptr ;
158+ }
159+ face[2 ] = chunk2 - 1 ;
139160 }
140161
141162 // Final keyword
You can’t perform that action at this time.
0 commit comments