Fixed some more NullPointerException errors
This commit is contained in:
parent
b0490105b3
commit
b63cef8c1b
1 changed files with 17 additions and 11 deletions
|
@ -43,12 +43,14 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
public void loadMarkdown(String filePath) {
|
||||
Runnable fileLoader = () -> {
|
||||
int result = file.load(filePath);
|
||||
if (editView != null) {
|
||||
if (result == MarkdownFile.SUCCESS) {
|
||||
editView.setMarkdown(getMarkdown());
|
||||
onMarkdownEdited();
|
||||
} else {
|
||||
editView.showFileLoadeddError(result);
|
||||
}
|
||||
}
|
||||
};
|
||||
fileLoader.run();
|
||||
}
|
||||
|
@ -62,6 +64,7 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
editView.setMarkdown(getMarkdown());
|
||||
onMarkdownEdited();
|
||||
} else {
|
||||
if (editView != null)
|
||||
editView.showFileLoadeddError(result);
|
||||
}
|
||||
};
|
||||
|
@ -99,11 +102,13 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
Runnable fileSaver = () -> {
|
||||
int code;
|
||||
code = file.save(filePath);
|
||||
if (editView != null) {
|
||||
if (code == MarkdownFile.SUCCESS) {
|
||||
editView.showFileSavedMessage();
|
||||
} else {
|
||||
editView.showFileSavedError(code);
|
||||
}
|
||||
}
|
||||
};
|
||||
fileSaver.run();
|
||||
}
|
||||
|
@ -173,6 +178,7 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
}
|
||||
loadMarkdown(in);
|
||||
} catch (Exception e) {
|
||||
if (editView != null)
|
||||
editView.showFileLoadeddError(MarkdownFile.READ_ERROR);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue