Skip to content

Commit

Permalink
Check if data is null before calling toString on it
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Cameron committed Jul 7, 2022
1 parent 054f433 commit cfee1b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion core/src/main/java/org/web3j/tx/Contract.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,15 @@ TransactionReceipt executeTransaction(
constructor);
}
} catch (JsonRpcError error) {
throw new TransactionException(error.getData().toString());

if (error.getData() != null) {
throw new TransactionException(error.getData().toString());
} else {
throw new TransactionException(
String.format(
"JsonRpcError thrown with code %d. Message: %s",
error.getCode(), error.getMessage()));
}
}

if (!(receipt instanceof EmptyTransactionReceipt)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=org.web3j
version=4.9.2-SNAPSHOT
version=4.9.2

0 comments on commit cfee1b6

Please sign in to comment.