fixes prev + next on undefined
This commit is contained in:
parent
cbf7ddafc1
commit
c7109c1525
|
@ -233,7 +233,7 @@ http.createServer((req, res) => {
|
|||
next: 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];
|
||||
switch(e.mime) {
|
||||
case "image/png":
|
||||
|
@ -257,13 +257,13 @@ http.createServer((req, res) => {
|
|||
data.size = formatSize(e.size);
|
||||
data.userchannel = e.userchannel;
|
||||
data.usernetwork = e.usernetwork;
|
||||
if(rows.length >= 2) {
|
||||
if(rows.length >= 2 && rows[1].length) {
|
||||
if(rows[1][0].id > parseInt(url))
|
||||
data.next = rows[1][0].id;
|
||||
else
|
||||
data.prev = rows[1][0].id;
|
||||
}
|
||||
if(rows.length >= 3) {
|
||||
if(rows.length >= 3 && rows[2].length) {
|
||||
if(rows[2][0].id > parseInt(url))
|
||||
data.next = rows[2][0].id;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user