3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-12 18:25:51 +00:00

Transaction: Fix two null pointer access warnings.

This commit is contained in:
Andreas Schildbach 2017-06-02 16:22:19 +02:00
parent 3fb4d6a1a3
commit 82fb22a884

View File

@ -680,8 +680,9 @@ public class Transaction extends ChildMessage {
try {
Script scriptSig = in.getScriptSig();
s.append(scriptSig);
if (in.getValue() != null)
s.append(" ").append(in.getValue().toFriendlyString());
final Coin value = in.getValue();
if (value != null)
s.append(" ").append(value.toFriendlyString());
s.append("\n ");
s.append("outpoint:");
final TransactionOutPoint outpoint = in.getOutpoint();
@ -719,9 +720,10 @@ public class Transaction extends ChildMessage {
if (!out.isAvailableForSpending()) {
s.append(" Spent");
}
if (out.getSpentBy() != null) {
final TransactionInput spentBy = out.getSpentBy();
if (spentBy != null) {
s.append(" by ");
s.append(out.getSpentBy().getParentTransaction().getHashAsString());
s.append(spentBy.getParentTransaction().getHashAsString());
}
} catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]");