Fix crash when drawing in the scratch pad
It should still be possible to paint of the canvas when there is no undo adapter present (happens in the scratch pad).
BUG:372190 Fixes T4479