From 03800044cb344d314ce0b9725dfb897518df3dc6 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Wed, 30 Aug 2017 17:59:34 -0600 Subject: [PATCH] Fixed NullPointerException on updating preview --- .../simplemarkdown/view/fragment/PreviewFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java index 87b024e..4b1a461 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java @@ -55,9 +55,11 @@ public class PreviewFragment extends Fragment implements MarkdownPreviewView { @Override public void updatePreview(String html) { - markdownPreview.post(() -> { - markdownPreview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); - }); + if (markdownPreview != null) { + markdownPreview.post(() -> { + markdownPreview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); + }); + } } @Override