Skip to content

Commit 865d035

Browse files
committed
fix visible NPE
1 parent 4807521 commit 865d035

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

framework/src/main/java/org/tron/core/services/http/TransferAssetServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
3737
.getInstance();
3838
JSONObject jsonObject = JSONObject.parseObject(contract);
3939
tx = Util.setTransactionPermissionId(jsonObject, tx);
40-
tx = Util.setTransactionExtraData(jsonObject, tx);
40+
tx = Util.setTransactionExtraData(jsonObject, tx, visible);
4141
response.getWriter().println(Util.printCreateTransaction(tx, visible));
4242
} catch (Exception e) {
4343
Util.processError(e, response);

framework/src/main/java/org/tron/core/services/http/TransferServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
3636
.getInstance();
3737
JSONObject jsonObject = JSONObject.parseObject(contract);
3838
tx = Util.setTransactionPermissionId(jsonObject, tx);
39-
tx = Util.setTransactionExtraData(jsonObject, tx);
39+
tx = Util.setTransactionExtraData(jsonObject, tx, visible);
4040
response.getWriter().println(Util.printCreateTransaction(tx, visible));
4141
} catch (Exception e) {
4242
Util.processError(e, response);

framework/src/main/java/org/tron/core/services/http/TriggerConstantContractServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
8484
trxExtBuilder,
8585
retBuilder);
8686
trx = Util.setTransactionPermissionId(jsonObject, trx);
87-
trx = Util.setTransactionExtraData(jsonObject, trx);
87+
trx = Util.setTransactionExtraData(jsonObject, trx, visible);
8888
trxExtBuilder.setTransaction(trx);
8989
retBuilder.setResult(true).setCode(response_code.SUCCESS);
9090
} catch (ContractValidateException e) {

framework/src/main/java/org/tron/core/services/http/Util.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ public static Transaction setTransactionPermissionId(JSONObject jsonObject,
347347
}
348348

349349
public static Transaction setTransactionExtraData(JSONObject jsonObject,
350-
Transaction transaction) {
350+
Transaction transaction, boolean visible) {
351351
if (jsonObject.containsKey(EXTRA_DATA)) {
352352
String data = jsonObject.getString(EXTRA_DATA);
353353
if (data.length() > 0) {
354354
Transaction.raw.Builder raw = transaction.getRawData().toBuilder();
355-
if (getVisibleOnlyForSign(jsonObject)) {
355+
if (visible) {
356356
raw.setData(ByteString.copyFrom(data.getBytes()));
357357
} else {
358358
raw.setData(ByteString.copyFrom(ByteArray.fromHexString(data)));

0 commit comments

Comments
 (0)