The fix from Anna:

1. Use TCanvas::SupportAlpha and add a protection against a null pointer (gPad).