brush masks: fix potential crash