[compositor] Avoid potential crash