Error instead of crashing when no text channels present

This commit is contained in:
Jeremy Zhang 2018-07-22 04:10:04 +00:00
parent a3e58ac43e
commit 856dd08167

View File

@ -591,6 +591,12 @@
} }
} }
if (typeof curr_default_channel == "object") { if (typeof curr_default_channel == "object") {
if (curr_default_channel == null) {
$("#messagebox").prop('disabled', true);
$("#messagebox").prop('placeholder', "NO TEXT CHANNELS");
Materialize.toast("You find yourself in a strange place. You don't have access to any text channels, or there are none in this server.", 20000);
return;
}
selected_channel = curr_default_channel.channel.id; selected_channel = curr_default_channel.channel.id;
} }
var this_channel = guild_channels[selected_channel]; var this_channel = guild_channels[selected_channel];
@ -1246,6 +1252,9 @@
var channel_id = selected_channel; var channel_id = selected_channel;
var fet; var fet;
var jumpscroll; var jumpscroll;
if (channel_id == null) {
return;
}
$("#message-spinner").fadeIn(); $("#message-spinner").fadeIn();
if (last_message_id == null) { if (last_message_id == null) {
$("#chatcontent").empty(); $("#chatcontent").empty();