Skip to content

Commit

Permalink
Merge pull request #108 from samuelmui8/branch-storage
Browse files Browse the repository at this point in the history
Fix storage bug where itemReview is null
  • Loading branch information
Ruizhi2001 authored Oct 26, 2023
2 parents c268c91 + 7ba71b5 commit b138bfe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/seedu/address/storage/JsonAdaptedItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ public Item toModelType() throws IllegalValueException {
throw new IllegalValueException(ItemName.MESSAGE_CONSTRAINTS);
}
final ItemName modelName = new ItemName(itemName);
Item item = new Item(modelName);

final ItemReview modelItemReview = itemReview.toModelType();
ItemReview modelItemReview = null;

if (itemReview != null) {
modelItemReview = itemReview.toModelType();
}

if (modelItemReview != null) {
item.setItemReview(modelItemReview);
return new Item(modelName, modelItemReview);
} else {
return new Item(modelName);
}
return item;
}
}

0 comments on commit b138bfe

Please sign in to comment.