Prevent null reference exception in box dragging.