GP-4217: Map null to null, not NPE

This commit is contained in:
Dan 2024-02-12 12:28:03 -05:00
parent 2d9a1ac539
commit eb16898b32

View File

@ -310,6 +310,9 @@ public class DBTraceGuestPlatform extends DBAnnotatedObject
@Override
public Address mapHostToGuest(Address hostAddress) {
if (hostAddress == null) {
return null;
}
try (LockHold hold = LockHold.lock(manager.lock.readLock())) {
Entry<Address, DBTraceGuestPlatformMappedRange> floorEntry =
rangesByHostAddress.floorEntry(hostAddress);
@ -322,6 +325,9 @@ public class DBTraceGuestPlatform extends DBAnnotatedObject
@Override
public AddressRange mapHostToGuest(AddressRange hostRange) {
if (hostRange == null) {
return null;
}
try (LockHold hold = LockHold.lock(manager.lock.readLock())) {
Entry<Address, DBTraceGuestPlatformMappedRange> floorEntry =
rangesByHostAddress.floorEntry(hostRange.getMinAddress());
@ -350,6 +356,9 @@ public class DBTraceGuestPlatform extends DBAnnotatedObject
@Override
public Address mapGuestToHost(Address guestAddress) {
if (guestAddress == null) {
return null;
}
try (LockHold hold = LockHold.lock(manager.lock.readLock())) {
Entry<Address, DBTraceGuestPlatformMappedRange> floorEntry =
rangesByGuestAddress.floorEntry(guestAddress);
@ -362,6 +371,9 @@ public class DBTraceGuestPlatform extends DBAnnotatedObject
@Override
public AddressRange mapGuestToHost(AddressRange guestRange) {
if (guestRange == null) {
return null;
}
try (LockHold hold = LockHold.lock(manager.lock.readLock())) {
Entry<Address, DBTraceGuestPlatformMappedRange> floorEntry =
rangesByGuestAddress.floorEntry(guestRange.getMinAddress());