diff --git a/src/lib.rs b/src/lib.rs index 4b23e1c..9dc85d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -226,6 +226,10 @@ impl PlotLine { /// Plot a line. Use this in closures passed to [`Plot::build()`](struct.Plot.html#method.build) pub fn plot(&self, x: &Vec, y: &Vec) { + // If there is no data to plot, we stop here + if x.len().min(y.len()) == 0 { + return; + } unsafe { implot_sys::ImPlot_PlotLinedoublePtrdoublePtr( im_str!("{}", self.label).as_ptr() as *const i8,