diff --git a/src/main/java/com/amazon/ion/impl/IonReaderContinuableCoreBinary.java b/src/main/java/com/amazon/ion/impl/IonReaderContinuableCoreBinary.java index b43bfe2071..71c4f9447e 100644 --- a/src/main/java/com/amazon/ion/impl/IonReaderContinuableCoreBinary.java +++ b/src/main/java/com/amazon/ion/impl/IonReaderContinuableCoreBinary.java @@ -527,7 +527,7 @@ void prepareScalar() { @Override public IntegerSize getIntegerSize() { - if (valueTid.type != IonType.INT || valueTid.isNull) { + if (valueTid == null || valueTid.type != IonType.INT || valueTid.isNull) { return null; } prepareScalar(); diff --git a/src/main/java/com/amazon/ion/impl/IonReaderTextSystemX.java b/src/main/java/com/amazon/ion/impl/IonReaderTextSystemX.java index 023288f03a..edf4431936 100644 --- a/src/main/java/com/amazon/ion/impl/IonReaderTextSystemX.java +++ b/src/main/java/com/amazon/ion/impl/IonReaderTextSystemX.java @@ -75,11 +75,11 @@ protected IonReaderTextSystemX(UnifiedInputStreamX iis) // into a base class (the *Value() methods also share a lot of similarity). public IntegerSize getIntegerSize() { - load_once(); if (_value_type != IonType.INT || _v.isNull()) { return null; } + load_once(); return _Private_ScalarConversions.getIntegerSize(_v.getAuthoritativeType()); } diff --git a/src/test/java/com/amazon/ion/streaming/ReaderIntegerSizeTest.java b/src/test/java/com/amazon/ion/streaming/ReaderIntegerSizeTest.java index cc31a06cb3..ed5802b054 100644 --- a/src/test/java/com/amazon/ion/streaming/ReaderIntegerSizeTest.java +++ b/src/test/java/com/amazon/ion/streaming/ReaderIntegerSizeTest.java @@ -105,6 +105,7 @@ public void testGetIntegerSizeNull() + "[] " + "() " ); + assertNull(in.getIntegerSize()); while (in.next() != null) { assertNull(in.getIntegerSize());