diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 3fca6cf0e8..30b13e21ec 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -681,10 +681,14 @@ bool View3DInventor::onHasMsg(const char* pMsg) const return true; else if (strcmp("SaveAs",pMsg) == 0) return true; - else if (strcmp("Undo",pMsg) == 0) - return getAppDocument()->getAvailableUndos() > 0; - else if (strcmp("Redo",pMsg) == 0) - return getAppDocument()->getAvailableRedos() > 0; + else if (strcmp("Undo",pMsg) == 0) { + App::Document* doc = getAppDocument(); + return doc && doc->getAvailableUndos() > 0; + } + else if (strcmp("Redo",pMsg) == 0) { + App::Document* doc = getAppDocument(); + return doc && doc->getAvailableRedos() > 0; + } else if (strcmp("Print",pMsg) == 0) return true; else if (strcmp("PrintPreview",pMsg) == 0)