]> git.lyx.org Git - features.git/blobdiff - src/Buffer.cpp
One should use dynamic_casts for inheritance-based casting.
[features.git] / src / Buffer.cpp
index 3eae06e13c0f0e8aab399ed5bfecbf17e652738a..0013804d77aa5e0b30af8eb5d17b7fa442edcb23 100644 (file)
@@ -2090,7 +2090,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                bool success = false;
                for (; it != end; ++it) {
                        if (it->lyxCode() == BRANCH_CODE) {
-                               InsetBranch & ins = static_cast<InsetBranch &>(*it);
+                               InsetBranch & ins = dynamic_cast<InsetBranch &>(*it);
                                if (ins.branch() == oldname) {
                                        undo().recordUndo(it);
                                        ins.rename(newname);
@@ -2835,7 +2835,7 @@ void Buffer::getUsedBranches(std::list<docstring> & result, bool const from_mast
        InsetIterator const end = inset_iterator_end(inset());
        for (; it != end; ++it) {
                if (it->lyxCode() == BRANCH_CODE) {
-                       InsetBranch & br = static_cast<InsetBranch &>(*it);
+                       InsetBranch & br = dynamic_cast<InsetBranch &>(*it);
                        docstring const name = br.branch();
                        if (!from_master && !params().branchlist().find(name))
                                result.push_back(name);