X-Git-Url: https://git.mar77i.info/?a=blobdiff_plain;f=webroot%2Ffirst%2Findex.js;fp=webroot%2Ffirst%2Findex.js;h=03b1f4990d8e5ebfeff5e696b42d5f7e094beafe;hb=3c5ec422ace644d848d2f845b0f3ef8de73462ef;hp=8cae34e6e39a60df7b28a53fafb70fe958de9d5a;hpb=16c0b1e580f2c92baf6882ec4dfa655c267d23b9;p=hublib diff --git a/webroot/first/index.js b/webroot/first/index.js index 8cae34e..03b1f49 100644 --- a/webroot/first/index.js +++ b/webroot/first/index.js @@ -3,7 +3,9 @@ var input_div = null; function write(msg) { - common.write(input_div.previousSibling, msg); + common.write( + input_div === null ? document.body : input_div.previousSibling, msg + ); } function change_name_button(hub) { @@ -74,7 +76,10 @@ function close() { write("connection lost"); - input_div.remove(); + if (input_div !== null) { + input_div.remove(); + input_div = null; + } } function message(msg) {