3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 03:35:52 +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 { try {
Script scriptSig = in.getScriptSig(); Script scriptSig = in.getScriptSig();
s.append(scriptSig); s.append(scriptSig);
if (in.getValue() != null) final Coin value = in.getValue();
s.append(" ").append(in.getValue().toFriendlyString()); if (value != null)
s.append(" ").append(value.toFriendlyString());
s.append("\n "); s.append("\n ");
s.append("outpoint:"); s.append("outpoint:");
final TransactionOutPoint outpoint = in.getOutpoint(); final TransactionOutPoint outpoint = in.getOutpoint();
@ -719,9 +720,10 @@ public class Transaction extends ChildMessage {
if (!out.isAvailableForSpending()) { if (!out.isAvailableForSpending()) {
s.append(" Spent"); s.append(" Spent");
} }
if (out.getSpentBy() != null) { final TransactionInput spentBy = out.getSpentBy();
if (spentBy != null) {
s.append(" by "); s.append(" by ");
s.append(out.getSpentBy().getParentTransaction().getHashAsString()); s.append(spentBy.getParentTransaction().getHashAsString());
} }
} catch (Exception e) { } catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]"); s.append("[exception: ").append(e.getMessage()).append("]");