Skip to content

Commit 3793a41

Browse files
committed
Fix crash when closing quick before player init
1 parent 67842d5 commit 3793a41

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/flyer_chat_video_message/lib/src/widgets/full_screen_video_player.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FullscreenVideoPlayer extends StatefulWidget {
2828

2929
class _FullscreenVideoPlayerState extends State<FullscreenVideoPlayer> {
3030
late VideoPlayerController _videoPlayer;
31-
late ChewieController _chewieController;
31+
late ChewieController? _chewieController;
3232
late double _aspectRatio;
3333

3434
@override
@@ -59,7 +59,7 @@ class _FullscreenVideoPlayerState extends State<FullscreenVideoPlayer> {
5959

6060
@override
6161
void dispose() {
62-
_chewieController.dispose();
62+
_chewieController?.dispose();
6363
_videoPlayer.dispose();
6464
super.dispose();
6565
}
@@ -76,8 +76,8 @@ class _FullscreenVideoPlayerState extends State<FullscreenVideoPlayer> {
7676
child: AspectRatio(
7777
aspectRatio: _aspectRatio,
7878
child:
79-
_videoPlayer.value.isInitialized
80-
? Chewie(controller: _chewieController)
79+
_videoPlayer.value.isInitialized && _chewieController != null
80+
? Chewie(controller: _chewieController!)
8181
: Container(
8282
width: 40,
8383
height: 40,

0 commit comments

Comments
 (0)