Selaa lähdekoodia

fix a bug when merging big particles

gsp 3 vuotta sitten
vanhempi
commit
5b322afbaf
1 muutettua tiedostoa jossa 12 lisäystä ja 4 poistoa
  1. 12 4
      OTSCPP/OTSImagePro/OTSImageProcess.cpp

+ 12 - 4
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -2637,19 +2637,27 @@ namespace OTSIMGPROC
 			std::map<std::string, std::vector<EleAreaPercentage>> mapEleData;
 
 			CPosXrayPtr pXray1 = p->GetXrayInfo();
-			for (auto ele : pXray1->GetElementQuantifyData())
+			if (pXray1 != nullptr)
 			{
-				mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
+				for (auto ele : pXray1->GetElementQuantifyData())
+				{
+					mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
+				}
 			}
+			
 
 			for (auto other : pair.second)
 			{
 				auto otherXray = other->GetXrayInfo();
-				for (auto eledata : otherXray->GetElementQuantifyData())
+				if (otherXray != nullptr)
 				{
-					mapEleData[eledata->GetName().GetBuffer()].push_back(EleAreaPercentage(other->GetArea() / allPartArea, eledata));
+					for (auto eledata : otherXray->GetElementQuantifyData())
+					{
+						mapEleData[eledata->GetName().GetBuffer()].push_back(EleAreaPercentage(other->GetArea() / allPartArea, eledata));
 
+					}
 				}
+				
 			}
 			// third,we calculate all the element's new percentage data and get a new element chemistry list.