mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix two more potential crashes for dives without samples
This should be all of them (famous last words). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9eb55a0fc6
commit
3fab68dcd3
2 changed files with 2 additions and 2 deletions
|
@ -131,7 +131,7 @@ bool DiveEventItem::shouldBeHidden()
|
||||||
* Don't bother showing those
|
* Don't bother showing those
|
||||||
*/
|
*/
|
||||||
struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0];
|
struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0];
|
||||||
if (!strcmp(event->name, "gaschange") && event->time.seconds == first_sample->time.seconds)
|
if (!strcmp(event->name, "gaschange") && first_sample && event->time.seconds == first_sample->time.seconds)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < evn_used; i++) {
|
for (int i = 0; i < evn_used; i++) {
|
||||||
|
|
|
@ -302,7 +302,7 @@ bool is_cylinder_used(struct dive *dive, int idx)
|
||||||
for_each_dc(dive, dc) {
|
for_each_dc(dive, dc) {
|
||||||
struct event *event = get_next_event(dc->events, "gaschange");
|
struct event *event = get_next_event(dc->events, "gaschange");
|
||||||
while (event) {
|
while (event) {
|
||||||
if (event->time.seconds == dc->sample[0].time.seconds)
|
if (dc->sample && event->time.seconds == dc->sample[0].time.seconds)
|
||||||
firstGasExplicit = true;
|
firstGasExplicit = true;
|
||||||
if (get_cylinder_index(dive, event) == idx)
|
if (get_cylinder_index(dive, event) == idx)
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue