Skip to content

Commit 6fd4e72

Browse files
committed
Fixed: Potential NPE in SQLRow.getString()
1 parent d74f1d0 commit 6fd4e72

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ SQL (C) Black Rook Software
33
by Matt Tropiano et al. (see AUTHORS.txt)
44

55

6+
Changed in 1.2.3
7+
----------------
8+
9+
- `Fixed` Potential NPE in SQLRow.getString()
10+
11+
612
Changed in 1.2.2
713
----------------
814

src/main/java/com/blackrook/sql/SQLRow.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,11 @@ else if (obj instanceof String)
487487

488488
private String getString(Object obj)
489489
{
490-
if (Utils.isArray(obj))
490+
if (obj == null)
491+
{
492+
return null;
493+
}
494+
else if (Utils.isArray(obj))
491495
{
492496
if (Utils.getArrayType(obj) == Byte.TYPE)
493497
return new String((byte[])obj);
@@ -543,7 +547,7 @@ else if (obj instanceof Blob)
543547
return new String(bos.toByteArray());
544548
}
545549
else
546-
return obj != null ? String.valueOf(obj) : null;
550+
return String.valueOf(obj);
547551
}
548552

549553
private Timestamp getTimestamp(Object obj)

0 commit comments

Comments
 (0)