mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: check we have dive before dereferencing
Coverity CID: 208341 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
652e382e68
commit
2c8614e43e
1 changed files with 6 additions and 4 deletions
|
@ -921,6 +921,12 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
||||||
QString startpressure, QString endpressure, QString gasmix, QString cylinder, int rating, int visibility)
|
QString startpressure, QString endpressure, QString gasmix, QString cylinder, int rating, int visibility)
|
||||||
{
|
{
|
||||||
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
|
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
|
||||||
|
|
||||||
|
if (!d) {
|
||||||
|
appendTextToLog("cannot commit changes: no dive");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DiveObjectHelper *myDive = new DiveObjectHelper(d);
|
DiveObjectHelper *myDive = new DiveObjectHelper(d);
|
||||||
|
|
||||||
// notes comes back as rich text - let's convert this into plain text
|
// notes comes back as rich text - let's convert this into plain text
|
||||||
|
@ -928,10 +934,6 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
||||||
doc.setHtml(notes);
|
doc.setHtml(notes);
|
||||||
notes = doc.toPlainText();
|
notes = doc.toPlainText();
|
||||||
|
|
||||||
if (!d) {
|
|
||||||
appendTextToLog("cannot commit changes: no dive");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bool diveChanged = false;
|
bool diveChanged = false;
|
||||||
bool needResort = false;
|
bool needResort = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue