Skip to content

Commit

Permalink
Explicit null checks to avoid it trickling down into code where it's …
Browse files Browse the repository at this point in the history
…harder to tell.
  • Loading branch information
fnuecke committed Jun 25, 2016
1 parent 422592d commit 9a3fd0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/scala/li/cil/oc/server/network/Network.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private class Network private(private val data: mutable.Map[String, Network.Vert
// ----------------------------------------------------------------------- //

def connect(nodeA: MutableNode, nodeB: MutableNode) = {
if (nodeA == null) throw new NullPointerException("nodeA")
if (nodeB == null) throw new NullPointerException("nodeB")

if (nodeA == nodeB) throw new IllegalArgumentException(
"Cannot connect a node to itself.")

Expand Down

0 comments on commit 9a3fd0f

Please sign in to comment.