Skip to content

Commit

Permalink
Fix possible null pointer dereference
Browse files Browse the repository at this point in the history
Call to temps may return nullptr if dynamic_cast fail to
cast pointer to db_temp* type.

Signed-off-by: Melg Eight <[email protected]>
  • Loading branch information
melg8 committed Feb 10, 2022
1 parent 72ab898 commit 2288ac9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions widgets/TempTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ void TempTreeView::fillContextMenu(QMenu *menu, QMenu *,
void TempTreeView::duplicateTemp()
{
pki_temp *temp = db_base::fromIndex<pki_temp>(currentIndex());
if (!temp || !basemodel)
db_temp* db_temp = temps();
if (!temp || !basemodel || !db_temp)
return;

pki_temp *newtemp = new pki_temp(temp);
newtemp->setIntName(newtemp->getIntName() + " " + tr("copy"));
temps()->insertPKI(newtemp);
db_temp->insertPKI(newtemp);
}

void TempTreeView::certFromTemp()
Expand Down

0 comments on commit 2288ac9

Please sign in to comment.