Changeset 22dc7b8 in subsurface


Ignore:
Timestamp:
Dec 20, 2017, 3:04:30 PM (5 weeks ago)
Author:
Lubomir I. Ivanov <neolit123@…>
Branches:
master
Children:
28ae35e
Parents:
0b2d224
git-author:
Berthold Stoeger <bstoeger@…> (12/19/17 14:39:24)
git-committer:
Lubomir I. Ivanov <neolit123@…> (12/20/17 15:04:30)
Message:

Handle plot_info->nr <= 0 gracefully

plot_info->nr should always be > 0. If this is not the case, write a
message to stderr instead of crashing in add_plot_pressure(). This
silences an use-of-uninitialized-variable warning.

Signed-off-by: Berthold Stoeger <bstoeger@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/profile.c

    r0b2d224 r22dc7b8  
    806806{
    807807        struct plot_data *entry;
     808        if (pi->nr <= 0) {
     809                fprintf(stderr, "add_plot_pressure(): called with pi->nr <= 0\n");
     810                return;
     811        }
    808812        for (int i = 0; i < pi->nr; i++) {
    809813                entry = pi->entry + i;
Note: See TracChangeset for help on using the changeset viewer.