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