Skip to content

Commit

Permalink
Fix NPE in IonRawBinaryWriter (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt authored Sep 18, 2023
1 parent 0a4b60e commit 4781fdd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/com/amazon/ion/impl/bin/IonRawBinaryWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ public void setTypeAnnotationSymbols(final SymbolToken... annotations)
{
for (final SymbolToken annotation : annotations)
{
if (annotation == null) break;
addTypeAnnotationSymbol(annotation.getSid());
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/com/amazon/ion/impl/bin/IonRawBinaryWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,13 @@ public void testSetAnnotations() throws Exception
assertValue("name::version::'''foobar'''");
}

@Test
public void testSetTypeAnnotationSymbolsWithNullInArray() throws IOException {
writer.setTypeAnnotationSymbols(systemSymbol(NAME_SID), null);
writer.writeBool(true);
assertValue("name::true");
}

@Test
public void testList() throws Exception
{
Expand Down

0 comments on commit 4781fdd

Please sign in to comment.