Skip to content

Commit

Permalink
fix: avoid NPE when transaction is not found (#313)
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Czeladka <[email protected]>
  • Loading branch information
matiwinnetou and Mateusz Czeladka authored Mar 7, 2025
1 parent dafd82c commit 9a7f9b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ public class SearchApiImpl implements SearchApi {
@Override
public ResponseEntity<SearchTransactionsResponse> searchTransactions(
SearchTransactionsRequest searchTransactionsRequest) {
if(offlineMode) {
if (offlineMode) {
throw ExceptionFactory.notSupportedInOfflineMode();
}
networkService.verifyNetworkRequest(searchTransactionsRequest.getNetworkIdentifier());


Long pageSize = Optional.ofNullable(searchTransactionsRequest.getLimit()).orElse(PAGE_SIZE);
pageSize = pageSize > PAGE_SIZE ? PAGE_SIZE : pageSize;
Long offset = Optional.ofNullable(searchTransactionsRequest.getOffset()).orElse(0L);
Expand All @@ -51,6 +50,6 @@ public ResponseEntity<SearchTransactionsResponse> searchTransactions(

return ResponseEntity.ok(searchMapper.mapToSearchTransactionsResponse(
blockTransactions, nextOffset));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class ApiException extends RuntimeException {
private final Error error;

public ApiException(Error error) {
super();
super(error.getMessage() == null ? "?" : error.getMessage());
this.error = error;
}

}

0 comments on commit 9a7f9b1

Please sign in to comment.