iucar / rpms / root

Forked from rpms/root 3 years ago
Clone
Blob Blame History Raw
diff --git a/graf2d/gpad/src/TPad.cxx b/graf2d/gpad/src/TPad.cxx
index 2b2b5b8..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()) {
+   while (!gSystem->ProcessEvents() && gPad) {
       if (gROOT->GetEditorMode() == 0) {
          if (hasname) {
             obj = FindObject(pname);