Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

fixed NPE in 'Insert Link' and 'Insert Image' actions

AuthorKarl Tauber <email>
Date2015-08-08 13:02:25 GMT+0200
Commit05fa88a681e34183cdba8fe1fc13c4ef20bdc403
Parent9b082c0
Delta7 lines added, 2 lines removed, 5-line increase
src/main/java/org/markdownwriterfx/editor/MarkdownEditorPane.java
public ObjectProperty<Path> pathProperty() { return path; }
+ private Path getParentPath() {
+ Path path = getPath();
+ return (path != null) ? path.getParent() : null;
+ }
+
private void textChanged(String newText) {
RootNode astRoot = parseMarkdown(newText);
public void insertLink() {
- LinkDialog dialog = new LinkDialog(getNode().getScene().getWindow(), getPath().getParent());
+ LinkDialog dialog = new LinkDialog(getNode().getScene().getWindow(), getParentPath());
dialog.showAndWait().ifPresent(result -> {
textArea.replaceSelection(result);
});
}
public void insertImage() {
- ImageDialog dialog = new ImageDialog(getNode().getScene().getWindow(), getPath().getParent());
+ ImageDialog dialog = new ImageDialog(getNode().getScene().getWindow(), getParentPath());
dialog.showAndWait().ifPresent(result -> {
textArea.replaceSelection(result);