Fixing potential serialization bug for the TransferOperation when no fee is specified

master
Nelson R. Perez 2017-02-16 21:53:43 -05:00
parent 89a7a1423c
commit b543a1c36d
1 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,6 @@ import java.lang.reflect.Type;
/**
* Class used to encapsulate the TransferOperation operation related functionalities.
* TODO: Add extensions support
*/
public class TransferOperation extends BaseOperation {
public static final String KEY_FEE = "fee";
@ -86,7 +85,8 @@ public class TransferOperation extends BaseOperation {
JsonArray array = new JsonArray();
array.add(this.getId());
JsonObject jsonObject = new JsonObject();
jsonObject.add(KEY_FEE, fee.toJsonObject());
if(fee != null)
jsonObject.add(KEY_FEE, fee.toJsonObject());
jsonObject.addProperty(KEY_FROM, from.toJsonString());
jsonObject.addProperty(KEY_TO, to.toJsonString());
jsonObject.add(KEY_AMOUNT, amount.toJsonObject());