diff --git a/graf2d/gpad/src/TPad.cxx b/graf2d/gpad/src/TPad.cxx index 06bd216..6efeec5 100644 --- a/graf2d/gpad/src/TPad.cxx +++ b/graf2d/gpad/src/TPad.cxx @@ -6312,6 +6312,8 @@ void TPad::UseCurrentStyle() TObject *TPad::WaitPrimitive(const char *pname, const char *emode) { + if (!gPad) return 0; + if (strlen(emode)) gROOT->SetEditorMode(emode); if (gROOT->GetEditorMode() == 0 && strlen(pname) > 2) gROOT->SetEditorMode(&pname[1]); @@ -6323,7 +6325,7 @@ TObject *TPad::WaitPrimitive(const char *pname, const char *emode) Bool_t hasname = strlen(pname) > 0; if (!pname[0] && !emode[0]) testlast = kTRUE; if (testlast) gROOT->SetEditorMode(); - while (!gSystem->ProcessEvents() && gROOT->GetSelectedPad()) { + while (!gSystem->ProcessEvents() && gPad) { if (gROOT->GetEditorMode() == 0) { if (hasname) { obj = FindObject(pname);