diff --git a/admin.php b/admin.php index 413c547..d66635d 100644 --- a/admin.php +++ b/admin.php @@ -178,7 +178,12 @@ $config_data = json_decode($raw_json_config, false); } function defaultNewArchive() { - lastlink = document.getElementById("archive_links").lastElementChild.getAttribute("href"); + try { + lastlink = document.getElementById("archive_links").lastElementChild.getAttribute("href"); + } catch(err) { + // last link not found, perhaps there is no archive yet + lastlink = "sentences-archive-8-aug-00.txt"; + } var re = /(\d+)-(\w\w\w)-(\d+)\.txt/; res = re.exec(lastlink);