extraction fixed. 35/17735/2
Cedric Delamarre [Wed, 27 Jan 2016 16:46:55 +0000 (17:46 +0100)]
function foo()
end

foo()(1)

who()(1)

Change-Id: Ifeaf7bee5c900711241be1d8e086f60a05e8e0ca

scilab/modules/ast/src/cpp/ast/run_CallExp.hpp

index 7193c21..692b8a2 100644 (file)
@@ -131,6 +131,16 @@ void RunVisitorT<T>::visitprivate(const CallExp &e)
     }
     types::InternalType* pIT = getResult();
 
+    // pIT can be NULL if one of call return nothing. foo()(1) with foo return nothing.
+    if(pIT == NULL)
+    {
+        clearResult();
+        std::wostringstream os;
+        os << _W("Cannot extract from nothing.") << std::endl;
+        CoverageInstance::stopChrono((void*)&e);
+        throw ast::InternalError(os.str(), 999, e.getLocation());
+    }
+
     types::typed_list out;
     types::typed_list in;
     types::optional_list opt;