gPad, the pointer to the current pad, is not defined from the time ROOT starts up until a pad is created.
What is the proper way for a script to determine whether or not gPad is defined?
I tried looking in gROOT->GetListOfGlobals(), or bypassing gPad by using gROOT->GetSelectedPad(), but neither of these works as I thought it would. In particular, gROOT->GetListOfGlobals() does not always seem to contain gPad even when gPad is defined, nor is gROOT->GetSelectedPad() always equal to gPad when the latter is defined.