diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 95a25f3..5d2510a 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -524,8 +524,10 @@ }); funct.fail(function(data) { Materialize.toast('Failed to send message.', 10000); - for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) { - Materialize.toast(data.responseJSON.illegal_reasons[i], 10000); + if (data.responseJSON) { + for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) { + Materialize.toast(data.responseJSON.illegal_reasons[i], 10000); + } } }); funct.catch(function(data) {