mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
fix: Properly parse null values api (#230)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
492857a8ad
commit
3d82207694
2 changed files with 4 additions and 5 deletions
|
|
@ -2,7 +2,6 @@ import 'dart:convert';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ class MediaStreamsModel {
|
|||
}
|
||||
|
||||
AudioStreamModel? get currentAudioStream {
|
||||
if (defaultAudioStreamIndex == -1) {
|
||||
if (defaultAudioStreamIndex == -1 || defaultAudioStreamIndex == null) {
|
||||
return AudioStreamModel.no();
|
||||
}
|
||||
return audioStreams.firstWhereOrNull((element) => element.index == defaultAudioStreamIndex) ??
|
||||
|
|
@ -46,7 +45,7 @@ class MediaStreamsModel {
|
|||
}
|
||||
|
||||
SubStreamModel? get currentSubStream {
|
||||
if (defaultSubStreamIndex == -1) {
|
||||
if (defaultSubStreamIndex == -1 || defaultSubStreamIndex == null) {
|
||||
return SubStreamModel.no();
|
||||
}
|
||||
return subStreams.firstWhereOrNull((element) => element.index == defaultSubStreamIndex) ?? subStreams.firstOrNull;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class VideoStream {
|
|||
final MediaStreamsModel? mediaStreamsModel;
|
||||
|
||||
AudioStreamModel? get currentAudioStream {
|
||||
if (audioStreamIndex == -1) {
|
||||
if (audioStreamIndex == -1 || audioStreamIndex == null) {
|
||||
return null;
|
||||
}
|
||||
return mediaStreamsModel?.audioStreams.firstWhereOrNull(
|
||||
|
|
@ -112,7 +112,7 @@ class VideoStream {
|
|||
}
|
||||
|
||||
SubStreamModel? get currentSubStream {
|
||||
if (subtitleStreamIndex == -1) {
|
||||
if (subtitleStreamIndex == -1 || subtitleStreamIndex == null) {
|
||||
return null;
|
||||
}
|
||||
return mediaStreamsModel?.subStreams.firstWhereOrNull(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue