[Bug 36876] Incorrect check for bad points in draw_poly()