Browse Source

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>
master
Slávek Banko 7 months ago
parent
commit
a08c6ac9e3
Signed by: SlavekB
GPG Key ID: 608F5293A04BE668
  1. 3
      src/archive.cpp
  2. 12
      src/basket.cpp

3
src/archive.cpp

@ -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);
}

12
src/basket.cpp

@ -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