Skip to content

Commit

Permalink
[api] Fix saveModel NPE bug (#989)
Browse files Browse the repository at this point in the history
Change-Id: I288d6ca80a7e987f2e527e18f020fee0f75d8156
  • Loading branch information
frankfliu authored May 30, 2021
1 parent 0e4c162 commit 6dc2949
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/main/java/ai/djl/BaseModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ protected Block loadFromBlockFactory() {
/** {@inheritDoc} */
@Override
public void save(Path modelPath, String newModelName) throws IOException {
if (newModelName == null || newModelName.isEmpty()) {
newModelName = modelName;
}
if (Files.notExists(modelPath)) {
Files.createDirectories(modelPath);
}
Expand Down

0 comments on commit 6dc2949

Please sign in to comment.