CV fix : CID #1321243 #1369586 76/19176/5
Siddhartha Gairola [Sat, 11 Mar 2017 21:37:03 +0000 (02:37 +0530)]
Change-Id: I53cd9e727ad90734fcf1572ecd9fc8bca1b8deb1

scilab/modules/elementary_functions/sci_gateway/cpp/sci_sum.cpp

index 945bf3f..2ede22a 100644 (file)
@@ -121,21 +121,25 @@ types::Function::ReturnValue sci_sum(types::typed_list &in, int _iRetCount, type
                 int iDims = 0;
                 int* piDimsArray = NULL;
 
-                if (pDblIn)
+                if (in[0]->isDouble())
                 {
+                    pDblIn = in[0]->getAs<types::Double>();
                     iDims = pDblIn->getDims();
                     piDimsArray = pDblIn->getDimsArray();
                 }
-                else if (pIntIn)
-                {
-                    iDims = pIntIn->getDims();
-                    piDimsArray = pIntIn->getDimsArray();
-                }
-                else
+                else if (in[0]->getType() == types::InternalType::ScilabPolynom)
                 {
+                    pPolyIn = in[0]->getAs<types::Polynom>();
                     iDims = pPolyIn->getDims();
                     piDimsArray = pPolyIn->getDimsArray();
                 }
+                else if (in[0]->isGenericType())
+                {
+                    pIntIn = in[0]->getAs<types::GenericType>();
+                    iDims = pIntIn->getDims();
+                    piDimsArray = pIntIn->getDimsArray();
+                }
+
 
                 // old function was "mtlsel"
                 for (int i = 0; i < iDims; i++)