Prevent a divide-by-zero bug in the pinch-to-zoom function