Skip to content

Commit

Permalink
fix(core/Node.java): Ensured the equals method only casts to `Node<…
Browse files Browse the repository at this point in the history
…?>` if the object is not null,

work on #73
  • Loading branch information
bsorrentino committed Feb 6, 2025
1 parent 103becc commit 79f8395
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/src/main/java/org/bsc/langgraph4j/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ public Node<State> withIdUpdated( Function<String,String> newId ) {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Node<?> node = (Node<?>) o;
return Objects.equals(id, node.id);
if (o == null ) return false;
if( o instanceof Node<?> node ) {
return Objects.equals(id, node.id);
}
return false;

}

/**
Expand Down

0 comments on commit 79f8395

Please sign in to comment.