fixes prev + next on undefined

This commit is contained in:
jkhsjdhjs 2016-08-16 19:59:12 +02:00
parent cbf7ddafc1
commit c7109c1525

View File

@ -233,7 +233,7 @@ http.createServer((req, res) => {
next: null, next: null,
prev: null prev: null
}; };
if(rows.length && rows[0][0].id == parseInt(url)) { if(rows.length && rows[0].length && rows[0][0].id == parseInt(url)) {
var e = rows[0][0]; var e = rows[0][0];
switch(e.mime) { switch(e.mime) {
case "image/png": case "image/png":
@ -257,13 +257,13 @@ http.createServer((req, res) => {
data.size = formatSize(e.size); data.size = formatSize(e.size);
data.userchannel = e.userchannel; data.userchannel = e.userchannel;
data.usernetwork = e.usernetwork; data.usernetwork = e.usernetwork;
if(rows.length >= 2) { if(rows.length >= 2 && rows[1].length) {
if(rows[1][0].id > parseInt(url)) if(rows[1][0].id > parseInt(url))
data.next = rows[1][0].id; data.next = rows[1][0].id;
else else
data.prev = rows[1][0].id; data.prev = rows[1][0].id;
} }
if(rows.length >= 3) { if(rows.length >= 3 && rows[2].length) {
if(rows[2][0].id > parseInt(url)) if(rows[2][0].id > parseInt(url))
data.next = rows[2][0].id; data.next = rows[2][0].id;
else else