@@ -490,45 +490,43 @@ STDMETHODIMP CShapefile::LoadDataFrom(BSTR ShapefileName, ICallback *cBack, VARI
490490 ErrorMessage (tkINMEMORY_SHAPEFILE_EXPECTED);
491491 return S_OK ;
492492 }
493- else
493+
494+ if (OpenCore (OLE2CA (ShapefileName), cBack))
494495 {
495- if (OpenCore (OLE2CA (ShapefileName), cBack))
496- {
497- // loading data in-memory
498- VARIANT_BOOL vb;
499- _isEditingShapes = false ;
500- StartEditingShapes (VARIANT_TRUE , cBack, &vb);
496+ // loading data in-memory
497+ VARIANT_BOOL vb;
498+ _isEditingShapes = false ;
499+ StartEditingShapes (VARIANT_TRUE , cBack, &vb);
501500
502- // this will trigger loading of all DBF values into the memory
503- long numFields;
504- this ->get_NumFields (&numFields);
505- if (numFields > 0 )
501+ // this will trigger loading of all DBF values into the memory
502+ long numFields;
503+ this ->get_NumFields (&numFields);
504+ if (numFields > 0 )
505+ {
506+ CComVariant var;
507+ for (size_t i = 0 ; i < _shapeData.size (); i++)
506508 {
507- CComVariant var;
508- for (size_t i = 0 ; i < _shapeData.size (); i++)
509- {
510- _table->get_CellValue (0 , i, &var);
511- }
509+ _table->get_CellValue (0 , i, &var);
512510 }
511+ }
513512
514- // closing disk file despite the result success or failure
515- _shpfileName = " " ;
516- _shxfileName = " " ;
517- _dbffileName = " " ;
518-
519- if ( _shpfile != NULL )
520- fclose (_shpfile);
521- _shpfile = NULL ;
513+ // closing disk file despite the result success or failure
514+ _shpfileName = " " ;
515+ _shxfileName = " " ;
516+ _dbffileName = " " ;
517+
518+ if ( _shpfile != NULL )
519+ fclose (_shpfile);
520+ _shpfile = NULL ;
522521
523- if ( _shxfile != NULL )
524- fclose (_shxfile);
525- _shxfile = NULL ;
522+ if ( _shxfile != NULL )
523+ fclose (_shxfile);
524+ _shxfile = NULL ;
526525
527- if ( _table != NULL )
528- ((CTableClass*)_table)->CloseUnderlyingFile ();
526+ if ( _table != NULL )
527+ ((CTableClass*)_table)->CloseUnderlyingFile ();
529528
530- *retval = vb;
531- }
529+ *retval = vb;
532530 }
533531 return S_OK ;
534532}
0 commit comments