Prevent null pointer deference in methods for selection.

This resolves the crash when exporting the Basket archive.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit a08c6ac9e3)
pull/10/head
Slávek Banko 3 years ago
parent 3f42b68ae4
commit 2bca54ade8
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -228,7 +228,8 @@ void Archive::saveBasketToArchive(Basket *basket, bool recursive, KTar *tar, TQS
// Recursively save child baskets:
BasketListViewItem *item = Global::bnpView->listViewItemForBasket(basket);
if (recursive && item->firstChild()) {
if (recursive && item && item->firstChild())
{
for (BasketListViewItem *child = (BasketListViewItem*) item->firstChild(); child; child = (BasketListViewItem*) child->nextSibling()) {
saveBasketToArchive(child->basket(), recursive, tar, backgrounds, tempFolder, progress);
}

@ -4469,12 +4469,20 @@ void Basket::noteUngroup()
void Basket::unplugSelection(NoteSelection *selection)
{
if (!selection)
{
return;
}
for (NoteSelection *toUnplug = selection->firstStacked(); toUnplug; toUnplug = toUnplug->nextStacked())
unplugNote(toUnplug->note);
}
void Basket::insertSelection(NoteSelection *selection, Note *after)
{
if (!selection)
{
return;
}
for (NoteSelection *toUnplug = selection->firstStacked(); toUnplug; toUnplug = toUnplug->nextStacked()) {
if (toUnplug->note->isGroup()) {
Note *group = new Note(this);
@ -4496,6 +4504,10 @@ void Basket::insertSelection(NoteSelection *selection, Note *after)
void Basket::selectSelection(NoteSelection *selection)
{
if (!selection)
{
return;
}
for (NoteSelection *toUnplug = selection->firstStacked(); toUnplug; toUnplug = toUnplug->nextStacked()) {
if (toUnplug->note->isGroup())
selectSelection(toUnplug);

Loading…
Cancel
Save