]> www.ginac.de Git - ginac.git/blobdiff - ginac/basic.cpp
[bugfix] Fix crash in basic::subs().
[ginac.git] / ginac / basic.cpp
index 1a3438e753c7627f03cfc902107d90c67a32a21a..59e7dbd97be7447cf2a3c4b1c020adc3fb4de6b5 100644 (file)
@@ -585,10 +585,11 @@ bool basic::match(const ex & pattern, exmap& repl_lst) const
 ex basic::subs_one_level(const exmap & m, unsigned options) const
 {
        if (options & subs_options::no_pattern) {
-               auto it = m.find(*this);
+               ex thisex = *this;  // NB: *this may be deleted here.
+               auto it = m.find(thisex);
                if (it != m.end())
                        return it->second;
-               return *this;
+               return thisex;
        } else {
                for (auto & it : m) {
                        exmap repl_lst;