summaryrefslogtreecommitdiffstats
path: root/core/profile.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/profile.c')
-rw-r--r--core/profile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/profile.c b/core/profile.c
index 327956cd5..e463c9c2b 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -805,6 +805,10 @@ static void populate_secondary_sensor_data(struct divecomputer *dc, struct plot_
static void add_plot_pressure(struct plot_info *pi, int time, int cyl, pressure_t p)
{
struct plot_data *entry;
+ if (pi->nr <= 0) {
+ fprintf(stderr, "add_plot_pressure(): called with pi->nr <= 0\n");
+ return;
+ }
for (int i = 0; i < pi->nr; i++) {
entry = pi->entry + i;