Skip to content

Commit feba1e7

Browse files
committed
Avoid NPE on JsonPatches#apply
1 parent b5c0377 commit feba1e7

File tree

1 file changed

+2
-2
lines changed
  • spar-wings-json-patch/src/main/java/jp/xet/sparwings/jackson/patch

1 file changed

+2
-2
lines changed

spar-wings-json-patch/src/main/java/jp/xet/sparwings/jackson/patch/JsonPatches.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class JsonPatches<T> implements UpdateRequest<T> {
3838
@SuppressWarnings("unchecked")
3939
public T apply(T original) throws IllegalPatchException {
4040
try {
41-
JsonPatch patch = JsonPatch.fromJson(this.node);
41+
JsonPatch patch = JsonPatch.fromJson(node);
4242
JsonNode originalNode = mapper.valueToTree(original);
4343
JsonNode patchedNode = patch.apply(originalNode);
4444
T patched = mapper.treeToValue(patchedNode, (Class<T>) original.getClass());
4545
return patched; // NOPMD
46-
} catch (IllegalArgumentException | JsonPatchException | IOException e) {
46+
} catch (IllegalArgumentException | JsonPatchException | IOException | NullPointerException e) { // NOPMD
4747
throw new IllegalPatchException(e);
4848
}
4949
}

0 commit comments

Comments
 (0)