Skip to content

Commit

Permalink
fix(markdown): Fix NPE on rerendering
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Niedermann <[email protected]>
  • Loading branch information
stefan-niedermann committed Feb 1, 2024
1 parent c1c29f2 commit 6fe87b8
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void setCurrentSingleSignOnAccount(@Nullable SingleSignOnAccount ssoAccou
mentionsPlugin.setCurrentSingleSignOnAccount(ssoAccount);
}

this.renderService.execute(() -> post(() -> this.markwon.setMarkdown(this, getMarkdownString().getValue().toString())));
rerender();
}

@Override
Expand All @@ -249,7 +249,7 @@ public void setSearchText(@Nullable CharSequence searchText, @Nullable Integer c
searchHighlightPlugin.setSearchText(searchText, current, this);
}

this.renderService.execute(() -> post(() -> this.markwon.setMarkdown(this, getMarkdownString().getValue().toString())));
rerender();
}

/**
Expand Down Expand Up @@ -287,6 +287,13 @@ public void setTextSize(int unit, float size) {
mentionsPlugin.setTextSize((int) getTextSize());
}

this.renderService.execute(() -> post(() -> this.markwon.setMarkdown(this, getMarkdownString().getValue().toString())));
rerender();
}

private void rerender() {
this.renderService.execute(() -> post(() -> {
final var currentValue = unrenderedText$.getValue();
this.markwon.setMarkdown(this, currentValue == null ? "" : currentValue.toString());
}));
}
}

0 comments on commit 6fe87b8

Please sign in to comment.