Fix js crash when posting msg also being ratelimited - test if json exists in content

This commit is contained in:
Jeremy Zhang 2017-05-13 16:19:19 +00:00
parent 0c544d015b
commit ddd9a2916a

View File

@ -524,8 +524,10 @@
}); });
funct.fail(function(data) { funct.fail(function(data) {
Materialize.toast('Failed to send message.', 10000); Materialize.toast('Failed to send message.', 10000);
for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) { if (data.responseJSON) {
Materialize.toast(data.responseJSON.illegal_reasons[i], 10000); for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) {
Materialize.toast(data.responseJSON.illegal_reasons[i], 10000);
}
} }
}); });
funct.catch(function(data) { funct.catch(function(data) {