xrdp: fix a crash in painter when invalid target is set