Skip to content

Commit

Permalink
Added exception handling for NaN.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMerfy committed Dec 21, 2017
1 parent b17dfcb commit c6521e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Grapher/src/graph/LineGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ public void addValue(double value){
* @param point using cartesian coordinates.
*/
public void addPoint(Point2D point){
if(point.getX() == Double.NaN)
throw new RuntimeException("X value must be a number.");
if(point.getY() == Double.NaN)
throw new RuntimeException();
point = translate(point);
points.add(point);
isNormalized = false;
Expand Down

0 comments on commit c6521e8

Please sign in to comment.