Explorar o código

modify some trivial things.(broken when MoveSEMToPoint failed,now it will give a error message on the console)

gsp %!s(int64=3) %!d(string=hai) anos
pai
achega
febe5d93ef

+ 5 - 0
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.h

@@ -500,6 +500,11 @@ namespace OTSCLRINTERFACE
 
 			pbseImg = m_pScan->AcquireBSEImage(a_nMatrixIndex, nReads, nDwell);
 
+			if (pbseImg == nullptr)
+			{
+				return false;
+			}
+
 			a_ImgData = gcnew CBSEImgClr(pbseImg);
 			return true;
 			

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -469,7 +469,7 @@ namespace OTSModelSharp
 
 
             pBSEImage = pScanController.AcquireBSEImage(0, 0, 2);
-      
+            
 
             return pBSEImage;
         }

+ 8 - 0
OTSIncAMeasureApp/0-OTSModel/Measure/BSEPicData/BSEImgFileMgr.cs

@@ -239,6 +239,10 @@ namespace OTSModelSharp
                 a_strPathName = openFileDialog.FileName;
             }
             Bitmap rstBm = CreateBitmap(m_poBSE.GetImageDataPtr(), m_poBSE.GetWidth(), m_poBSE.GetHeight());
+            if (rstBm == null)
+            {
+                return false;
+            }
             rstBm.Save(a_strPathName);
            
 
@@ -263,6 +267,10 @@ namespace OTSModelSharp
         /// <returns></returns>
         public static Bitmap CreateBitmap(byte[] originalImageData, int originalWidth, int originalHeight)
         {
+            if (originalImageData == null || originalWidth == 0 || originalHeight == 0)
+            {
+                return null;
+            }
             //指定8位格式,即256色
             Bitmap resultBitmap = new Bitmap(originalWidth, originalHeight, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
             //将该位图存入内存中

+ 4 - 1
OTSIncAMeasureApp/ServiceCenter/ScanController.cs

@@ -25,7 +25,10 @@ namespace OTSModelSharp.ServiceInterface
             Init();
             Rectangle r = new Rectangle();
             CBSEImgClr bse = new CBSEImgClr(r);
-            scan.AcquireBSEImage(matrixIndex, reads, dwell, ref bse);
+           if (!scan.AcquireBSEImage(matrixIndex, reads, dwell, ref bse))
+            {
+                return null;
+            }
        
             return bse;
         }