From dcc17e88ed2993e493cb0dfc1e048d8660de4cfd Mon Sep 17 00:00:00 2001 From: Grigory Date: Fri, 25 Mar 2022 18:53:22 -0400 Subject: [PATCH] Fix Grid equals (#78) * Grid equals * Upd the CHANGELOG --- CHANGELOG.md | 2 ++ .../java/org/locationtech/proj4j/datum/Grid.java | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9258a70..92abfa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Fix Grid equals [#78](https://github.com/locationtech/proj4j/pull/78) + ## [1.1.4] - 2021-11-03 ### Fixed diff --git a/src/main/java/org/locationtech/proj4j/datum/Grid.java b/src/main/java/org/locationtech/proj4j/datum/Grid.java index f1abb9b..6c63360 100755 --- a/src/main/java/org/locationtech/proj4j/datum/Grid.java +++ b/src/main/java/org/locationtech/proj4j/datum/Grid.java @@ -388,17 +388,17 @@ public boolean equals(Object that) { if (that instanceof Grid) { Grid g = (Grid) that; if (gridName == null && g.gridName != null) return false; - if (!gridName.equals(g.gridName)) return false; + if (gridName != null && !gridName.equals(g.gridName)) return false; if (fileName == null && g.fileName != null) return false; - if (!fileName.equals(g.fileName)) return false; + if (fileName != null && !fileName.equals(g.fileName)) return false; if (format == null && g.format != null) return false; - if (!format.equals(g.format)) return false; + if (format != null && !format.equals(g.format)) return false; if (table == null && g.table != null) return false; - if (!table.equals(g.table)) return false; + if (table != null && !table.equals(g.table)) return false; if (next == null && g.next != null) return false; - if (!next.equals(g.next)) return false; + if (next != null && !next.equals(g.next)) return false; if (child == null && g.child != null) return false; - if (!child.equals(g.child)) return false; + if (child != null && !child.equals(g.child)) return false; return true; } else { return false;