diff --git a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp index df9466f3f6e4..2beb4f8c1fe1 100644 --- a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp +++ b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp @@ -7660,7 +7660,9 @@ void ApplicationWindow::exportPDF() if (!w) return; - if (w->isA("MultiLayer") && (dynamic_cast(w))->isEmpty()){ + auto ml = dynamic_cast(w); + + if (w->isA("MultiLayer") && ml && ml->isEmpty()) { QMessageBox::warning(this,tr("MantidPlot - Warning"),//Mantid tr("

There are no plot layers available in this window.

")); return;