Long press on video group (by folder) crashes
Description
Performing a long press on a group of videos grouped by folder will cause a crash. This doesn't happen when grouped by name
Actual behavior
2023-05-03 16:05:22.599 7728-7728/org.videolan.vlc.debug E/VLC/VlcCrashHandler: java.lang.NullPointerException: Attempt to invoke interface method 'android.view.MenuItem android.view.MenuItem.setVisible(boolean)' on a null object reference
at org.videolan.vlc.gui.video.VideoGridFragment.onPrepareActionMode(VideoGridFragment.kt:389)
at androidx.appcompat.app.AppCompatDelegateImpl$ActionModeCallbackWrapperV9.onPrepareActionMode(AppCompatDelegateImpl.java:2713)
at androidx.appcompat.view.StandaloneActionMode.invalidate(StandaloneActionMode.java:100)
at androidx.appcompat.app.AppCompatDelegateImpl.startSupportActionModeFromWindow(AppCompatDelegateImpl.java:1337)
at androidx.appcompat.app.AppCompatDelegateImpl.startSupportActionMode(AppCompatDelegateImpl.java:1222)
at androidx.appcompat.app.BaseContextWrappingDelegate.startSupportActionMode(BaseContextWrappingDelegate.kt:97)
at androidx.appcompat.app.AppCompatActivity.startSupportActionMode(AppCompatActivity.java:364)
at org.videolan.vlc.gui.MainActivity.startSupportActionMode(MainActivity.kt:173)
at org.videolan.vlc.gui.BaseFragment.startActionMode(BaseFragment.kt:108)
at org.videolan.vlc.gui.video.VideoGridFragment.onLongClick(VideoGridFragment.kt:611)
at org.videolan.vlc.gui.video.VideoGridFragment.process(VideoGridFragment.kt:579)
at org.videolan.vlc.gui.video.VideoGridFragment.access$process(VideoGridFragment.kt:78)
at org.videolan.vlc.gui.video.VideoGridFragment$onCreate$5.invokeSuspend(VideoGridFragment.kt:123)
at org.videolan.vlc.gui.video.VideoGridFragment$onCreate$5.invoke(Unknown Source:8)
at org.videolan.vlc.gui.video.VideoGridFragment$onCreate$5.invoke(Unknown Source:4)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:14)
(Coroutine boundary)
at androidx.lifecycle.PausingDispatcherKt$whenStateAtLeast$2.invokeSuspend(PausingDispatcher.kt:162)
at androidx.lifecycle.LifecycleCoroutineScope$launchWhenStarted$1.invokeSuspend(Lifecycle.kt:97)
at Android.MODEL(Pixel 6a)
at Android.VERSION(13)
at Android.FINGERPRINT(google/bluejay/bluejay:13/TQ2A.230305.008.E1/9677224:user/release-keys)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [CoroutineId(21), "coroutine#21":StandaloneCoroutine{Cancelling}@85e616a, Dispatchers.Main.immediate]
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'android.view.MenuItem android.view.MenuItem.setVisible(boolean)' on a null object reference
at org.videolan.vlc.gui.video.VideoGridFragment.onPrepareActionMode(VideoGridFragment.kt:389)
at androidx.appcompat.app.AppCompatDelegateImpl$ActionModeCallbackWrapperV9.onPrepareActionMode(AppCompatDelegateImpl.java:2713)
at androidx.appcompat.view.StandaloneActionMode.invalidate(StandaloneActionMode.java:100)
at androidx.appcompat.app.AppCompatDelegateImpl.startSupportActionModeFromWindow(AppCompatDelegateImpl.java:1337)
at androidx.appcompat.app.AppCompatDelegateImpl.startSupportActionMode(AppCompatDelegateImpl.java:1222)
at androidx.appcompat.app.BaseContextWrappingDelegate.startSupportActionMode(BaseContextWrappingDelegate.kt:97)
at androidx.appcompat.app.AppCompatActivity.startSupportActionMode(AppCompatActivity.java:364)
at org.videolan.vlc.gui.MainActivity.startSupportActionMode(MainActivity.kt:173)
at org.videolan.vlc.gui.BaseFragment.startActionMode(BaseFragment.kt:108)
at org.videolan.vlc.gui.video.VideoGridFragment.onLongClick(VideoGridFragment.kt:611)
at org.videolan.vlc.gui.video.VideoGridFragment.process(VideoGridFragment.kt:579)
at org.videolan.vlc.gui.video.VideoGridFragment.access$process(VideoGridFragment.kt:78)
at org.videolan.vlc.gui.video.VideoGridFragment$onCreate$5.invokeSuspend(VideoGridFragment.kt:123)
Steps to reproduce
- Group videos by folder
- Long press on a group
Screenshot / video
Context
App version
Master / vlc3
Android version
13
Device model
Pixel 6a
App mode
Smartphone