Skip to content

Commit

Permalink
fix(vacuum.roborock): Fix map parsing failing for maps with no image …
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
Hypfer committed Jul 25, 2020
1 parent ef4e010 commit f187906
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/RRMapParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ class RRMapParser {
*/
static PARSE_IMAGE_BLOCK(block) {
const parsedBlock = {
segments: {},
pixels: {}
segments: {}
};
let view;
let mayContainSegments = false;
Expand Down Expand Up @@ -321,7 +320,7 @@ class RRMapParser {
* @returns {null|import("./entities/map/ValetudoMap")}
*/
static POST_PROCESS_BLOCKS(metaData, blocks) {
if (blocks[BlockTypes.IMAGE]) { //We need the image to flip everything else correctly
if (blocks[BlockTypes.IMAGE] && blocks[BlockTypes.IMAGE].pixels) { //We need the image to flip everything else correctly
const layers = [
new Map.MapLayer({
pixels: blocks[BlockTypes.IMAGE].pixels.floor,
Expand Down Expand Up @@ -370,7 +369,7 @@ class RRMapParser {
if (blocks[BlockTypes.PATH].points.length >= 4) {
angle = Math.round(Math.atan2(
points[points.length - 1] -
points[points.length - 3],
points[points.length - 3],

points[points.length - 2] -
points[points.length - 4]
Expand Down

0 comments on commit f187906

Please sign in to comment.