mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: prevent uninitialized pointer
This should never matter as we should never call undoit before redoit. Extra ensurance that we don't access random data. Found by Coverity. Fixes CID 350076 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e89a87a2e8
commit
80f76773c1
1 changed files with 6 additions and 0 deletions
|
@ -383,6 +383,9 @@ AddDive::AddDive(dive *d, bool autogroup, bool newNumber)
|
|||
d->dc.maxdepth.mm = 0;
|
||||
fixup_dive(d);
|
||||
|
||||
// this only matters if undoit were called before redoit
|
||||
currentDive = nullptr;
|
||||
|
||||
// Get an owning pointer to a moved dive.
|
||||
OwningDivePtr divePtr(move_dive(d));
|
||||
divePtr->selected = false; // If we clone a planned dive, it might have been selected.
|
||||
|
@ -453,6 +456,9 @@ ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, str
|
|||
{
|
||||
setText(tr("import %n dive(s) from %1", "", dives->nr).arg(source));
|
||||
|
||||
// this only matters if undoit were called before redoit
|
||||
currentDive = nullptr;
|
||||
|
||||
struct dive_table dives_to_add = { 0 };
|
||||
struct dive_table dives_to_remove = { 0 };
|
||||
struct trip_table trips_to_add = { 0 };
|
||||
|
|
Loading…
Add table
Reference in a new issue