X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.pl;h=1ca923d462fb9556442434612e0c9f9c3d6bee3e;hp=07e82e19d2578c73e6c10e3e9cf76caa6a60e797;hb=c0fcba137d26486085ed5d4104b34d2c44978693;hpb=ff8b400eb500618644231ed9e6f199c3b0b25135 diff --git a/ginac/function.pl b/ginac/function.pl index 07e82e19..1ca923d4 100644 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -536,7 +536,6 @@ public: static unsigned register_new(function_options const & opt); static unsigned current_serial; static unsigned find_function(const std::string &name, unsigned nparams); - static std::vector get_registered_functions() { return registered_functions(); }; unsigned get_serial() const {return serial;} std::string get_name() const; @@ -844,6 +843,9 @@ function::function(unsigned ser, const exprseq & es) : exprseq(es), serial(ser) function::function(unsigned ser, const exvector & v, bool discardable) : exprseq(v,discardable), serial(ser) { + if ( ser >= registered_functions().size() ) { + throw std::runtime_error("function does not exist"); + } } function::function(unsigned ser, std::auto_ptr vp) @@ -1389,7 +1391,9 @@ unsigned function::find_function(const std::string &name, unsigned nparams) /** Return the print name of the function. */ std::string function::get_name() const { - GINAC_ASSERT(serial= registered_functions().size() ) { + throw std::runtime_error("unknown function"); + } return registered_functions()[serial].name; }