don't throw an error if no tile data is found

This commit is contained in:
synth-ruiner 2017-12-23 21:17:57 +00:00
parent 6c0e705005
commit 2134e4fe35
1 changed files with 12 additions and 9 deletions

View File

@ -124,6 +124,7 @@ $(document).ready(function() {
var tiles = input.match(/TIL (.*)\n([01]{8}\n){8}/g); var tiles = input.match(/TIL (.*)\n([01]{8}\n){8}/g);
if (tiles.length > 0) {
for (var i = 0; i < tiles.length; i++) { for (var i = 0; i < tiles.length; i++) {
var name = tiles[i].match(/TIL .*/)[0].replace('TIL ', ''); var name = tiles[i].match(/TIL .*/)[0].replace('TIL ', '');
@ -136,6 +137,7 @@ $(document).ready(function() {
bitmap: _.chunk(bitmap, 8) bitmap: _.chunk(bitmap, 8)
}; };
} }
}
// set palette to first imported palette and redraw // set palette to first imported palette and redraw
palette = _.first(_.sortBy(bitsyData.palettes, 'sortOrder')); palette = _.first(_.sortBy(bitsyData.palettes, 'sortOrder'));
@ -282,6 +284,7 @@ $(document).ready(function() {
} }
}); });
}); });
document.getElementById('room-output').getContext('2d').putImageData(imageData, 0, 0); document.getElementById('room-output').getContext('2d').putImageData(imageData, 0, 0);
}); });
}, 30); }, 30);