From 23edfde99eb0c814be23f292036674726fdfc3d3 Mon Sep 17 00:00:00 2001 From: chumv Date: Thu, 5 Dec 2024 15:23:00 +0200 Subject: [PATCH] Fix possible npe with smartFolder --- .../myplaces/tracks/dialogs/SmartFolderFragment.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/myplaces/tracks/dialogs/SmartFolderFragment.kt b/OsmAnd/src/net/osmand/plus/myplaces/tracks/dialogs/SmartFolderFragment.kt index fefe5aa8ae9..8aaefd57a09 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/tracks/dialogs/SmartFolderFragment.kt +++ b/OsmAnd/src/net/osmand/plus/myplaces/tracks/dialogs/SmartFolderFragment.kt @@ -6,6 +6,7 @@ import androidx.fragment.app.FragmentManager import net.osmand.plus.R import net.osmand.plus.myplaces.tracks.DialogClosedListener import net.osmand.plus.myplaces.tracks.EmptySmartFolderListener +import net.osmand.plus.myplaces.tracks.ItemsSelectionHelper import net.osmand.plus.utils.AndroidUtils import net.osmand.plus.widgets.popup.PopUpMenu import net.osmand.plus.widgets.popup.PopUpMenuDisplayData @@ -153,4 +154,13 @@ class SmartFolderFragment : TrackFolderFragment(), SmartFolderUpdateListener, override fun onDialogClosed() { updateContent() } + + override fun getSelectionHelper(): ItemsSelectionHelper { + return ItemsSelectionHelper().apply { + val items = smartFolder.getTrackItems() + setAllItems(items) + setSelectedItems(items) + setOriginalSelectedItems(items) + } + } } \ No newline at end of file