From fa9918fe009cdf28b2dbfe530c2c0bc101a7c270 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Wed, 25 Jan 2023 14:48:15 +0100 Subject: [PATCH] fix issue where some json have empty elements for x and y. --- R/heatmap.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/heatmap.R b/R/heatmap.R index 73bd027..e3a22ff 100644 --- a/R/heatmap.R +++ b/R/heatmap.R @@ -176,9 +176,12 @@ read_heatmap_records <- function(records, viewport_dims) { ) lapply(tmp_data, function(d) { - d$x <- round(d$x * viewport_dims$width) - d$y <- round(d$y * viewport_dims$height) - d + # Some case where x and y are empty lists... + if (length(d$x) > 0 && length(d$y) > 0) { + d$x <- round(d$x * viewport_dims$width) + d$y <- round(d$y * viewport_dims$height) + d + } }) }