mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Two if's to prevent null pointer dereferencing
I need these to prevent subsurface from segfaulting when opening a new log. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
16ac0bc45d
commit
be0a708db0
1 changed files with 5 additions and 1 deletions
|
@ -29,6 +29,9 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
|
||||||
return QVariant();
|
return QVariant();
|
||||||
struct dive_site *ds = get_dive_site(index.row());
|
struct dive_site *ds = get_dive_site(index.row());
|
||||||
|
|
||||||
|
if (!ds)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
switch(role) {
|
switch(role) {
|
||||||
case Qt::DisplayRole : return qPrintable(ds->name);
|
case Qt::DisplayRole : return qPrintable(ds->name);
|
||||||
case DIVE_SITE_UUID : return ds->uuid;
|
case DIVE_SITE_UUID : return ds->uuid;
|
||||||
|
@ -77,7 +80,8 @@ bool LocationInformationModel::removeRows(int row, int count, const QModelIndex
|
||||||
|
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
beginRemoveRows(QModelIndex(), row, row);
|
||||||
struct dive_site *ds = get_dive_site(row);
|
struct dive_site *ds = get_dive_site(row);
|
||||||
delete_dive_site(ds->uuid);
|
if (ds)
|
||||||
|
delete_dive_site(ds->uuid);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue