Fix NPE for `OsmReader#estimateMemoryUsageBytes()` (#389)

A `NullPointerException` was thrown when this method was called after
calling `close()` (which happens when using the `PrometheusStats`
client).
pull/390/head
Erik Price 2022-11-21 21:13:29 +01:00 zatwierdzone przez GitHub
rodzic 9ead458f7f
commit 7f6032b641
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -541,7 +541,7 @@ public class OsmReader implements Closeable, MemoryEstimator.HasEstimate {
@Override
public long estimateMemoryUsageBytes() {
long size = 0;
size += waysInMultipolygon.serializedSizeInBytes();
size += waysInMultipolygon == null ? 0 : waysInMultipolygon.serializedSizeInBytes();
// multipolygonWayGeometries is reported separately
size += estimateSize(wayToRelations);
size += estimateSize(relationInfo);