fix #517 and #518, empty data and empty img tags

- return NULL if x is empty/null, no need to try to plot something
- check for this NULL when saving to html or latex
diff --git a/R/mini_plots.R b/R/mini_plots.R
index e1c65d3..1c15262 100644
--- a/R/mini_plots.R
+++ b/R/mini_plots.R
@@ -46,6 +46,8 @@
     )}))
   }
 
+  if (is.null(x)) return(NULL)
+
   if (is.null(lim)) {
     lim <- base::range(x)
   }
@@ -147,6 +149,8 @@
     )}))
   }
 
+  if (is.null(x)) return(NULL)
+
   if (is.null(lim)) {
     lim <- base::range(x)
     lim[1] <- lim[1] - (lim[2] - lim[1]) / 10
@@ -284,6 +288,8 @@
     }, x, y))
   }
 
+  if (is.null(x)) return(NULL)
+
   if (is.null(y) || !length(y)) {
     y <- x
     x <- seq(0, 1, length.out = length(y))