Improve the empty logbook ringbuffer detection
If all the entries in the logbook ringbuffer happen to be empty, the ringbuffer end pointer will not have a valid value. Creating the ringbuffer stream will fail, and an error will be returned to the caller. Fixed by adding an extra check, and exit if there are no dives.
This commit is contained in:
parent
1d235daf30
commit
f93b2afcc8
@ -417,6 +417,11 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
|
||||
progress->maximum -= (layout->rb_profile_end - layout->rb_profile_begin) - rb_profile_size;
|
||||
device_event_emit (abstract, DC_EVENT_PROGRESS, progress);
|
||||
|
||||
// Exit if there are no dives.
|
||||
if (rb_profile_size == 0) {
|
||||
return DC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// Create the ringbuffer stream.
|
||||
dc_rbstream_t *rbstream = NULL;
|
||||
rc = dc_rbstream_new (&rbstream, abstract, PAGESIZE, PAGESIZE * device->multipage, layout->rb_profile_begin, layout->rb_profile_end, rb_profile_end);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user