fix broken admin site when no archives are present

This commit is contained in:
Tristan Schneider 2021-11-28 10:35:22 +00:00
parent 2f7a031eca
commit 0e566d1883

View File

@ -178,7 +178,12 @@ $config_data = json_decode($raw_json_config, false);
} }
function defaultNewArchive() { function defaultNewArchive() {
try {
lastlink = document.getElementById("archive_links").lastElementChild.getAttribute("href"); 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/; var re = /(\d+)-(\w\w\w)-(\d+)\.txt/;
res = re.exec(lastlink); res = re.exec(lastlink);