fix no faction war submit 500

pull/6/head
Florian Hartwich 2017-08-13 09:16:03 +02:00
parent a7412af2ef
commit 4d72a7d02f
1 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,6 @@ wars.route('/')
if (err) {
return next(err);
}
//TODO: combine run and clean in one script, so log file gets touched only once
exec(__dirname + '/../war-parser/run.sh ' + folderName + ' ' + war._id, (error, stdout) => {
if (error) {
return next(error);
@ -93,7 +92,9 @@ wars.route('/')
}
let obj = JSON.parse(`${stdout}`);
for (let i = 0; i < obj.length; i++) {
if (obj[i].fraction === 'BLUFOR') {
if (!obj[i].fraction) {
obj.splice(i, 1);
} else if (obj[i].fraction === 'BLUFOR') {
war.playersBlufor++;
} else {
war.playersOpfor++;