Mercurial > public > sg101
changeset 978:a828e80223d2
Prevent 500 error when previewing no text.
Don't call image_check() when there is no data.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 05 Oct 2015 20:26:14 -0500 |
parents | ba0f4a5f1fca |
children | a6331579ff43 |
files | comments/views.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/comments/views.py Mon Oct 05 20:20:34 2015 -0500 +++ b/comments/views.py Mon Oct 05 20:26:14 2015 -0500 @@ -145,10 +145,11 @@ return HttpResponseBadRequest('No data') html = site_markup(data) - try: - image_check(html) - except ImageCheckError as ex: - html = PREVIEW_UNAVAILABLE.format(ex) + if html: + try: + image_check(html) + except ImageCheckError as ex: + html = PREVIEW_UNAVAILABLE.format(ex) return render_to_response('comments/markdown_preview.html', { 'data': html,