提交 71640a0b authored 作者: kongdywang's avatar kongdywang

Avoid the null pointer issue that arises from calling the dispose method of the…

Avoid the null pointer issue that arises from calling the dispose method of the on-demand and live streaming controller multiple times
上级 681d3648
...@@ -377,9 +377,9 @@ class TXLivePlayerController extends ChangeNotifier implements ValueListenable<T ...@@ -377,9 +377,9 @@ class TXLivePlayerController extends ChangeNotifier implements ValueListenable<T
Future<void> dispose() async { Future<void> dispose() async {
_isNeedDisposed = true; _isNeedDisposed = true;
if (!_isDisposed) { if (!_isDisposed) {
await _eventSubscription!.cancel(); await _eventSubscription?.cancel();
_eventSubscription = null; _eventSubscription = null;
await _netSubscription!.cancel(); await _netSubscription?.cancel();
_netSubscription = null; _netSubscription = null;
await _release(); await _release();
......
...@@ -720,9 +720,9 @@ class TXVodPlayerController extends ChangeNotifier implements ValueListenable<TX ...@@ -720,9 +720,9 @@ class TXVodPlayerController extends ChangeNotifier implements ValueListenable<TX
Future<void> dispose() async { Future<void> dispose() async {
_isNeedDisposed = true; _isNeedDisposed = true;
if (!_isDisposed) { if (!_isDisposed) {
await _eventSubscription!.cancel(); await _eventSubscription?.cancel();
_eventSubscription = null; _eventSubscription = null;
await _netSubscription!.cancel(); await _netSubscription?.cancel();
_netSubscription = null; _netSubscription = null;
await _release(); await _release();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论