diff --git a/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp index f8e04758a9ba..6d38ddc7f8a2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp @@ -328,10 +328,11 @@ namespace MDAlgorithms MDBox * mdBox = dynamic_cast *>(Box); if(!mdBox) throw std::runtime_error("found unfamiliar type of box"); // Store the index + uint64_t nEvents = mdBox->getNPoints(); box_event_index[id*2] = mdBox->getFilePosition(); - box_event_index[id*2+1] = mdBox->getNPoints(); + box_event_index[id*2+1] = nEvents; // save for the first time - if(!update)mdBox->saveNexus(file); + if(!update && nEvents>0)mdBox->saveNexus(file); // set that it is on disk and clear the actual events to free up memory, saving occured earlier if (MakeFileBacked) mdBox->clearDataFromMemory();