# HG changeset patch # User Brian Neal # Date 1444094774 18000 # Node ID a828e80223d238b5fcd3913bf8cb8411d584fdda # Parent ba0f4a5f1fca145909a83beb0fc1bb293d10f6ac Prevent 500 error when previewing no text. Don't call image_check() when there is no data. diff -r ba0f4a5f1fca -r a828e80223d2 comments/views.py --- 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,