Skip to content

Commit

Permalink
fix: return null
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Nov 1, 2024
1 parent 0b1bd82 commit 8ce7045
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/lib/providers/APIs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class APIs {
if (sp.code != 0) {
throw sp.message;
}
return sp.data as List<String>;
return sp.data==null? []:sp.data as List<String>;
}

static Future<List<String>> downloadAllMovies() async {
Expand All @@ -142,7 +142,7 @@ class APIs {
if (sp.code != 0) {
throw sp.message;
}
return sp.data as List<String>;
return sp.data==null? []:sp.data as List<String>;
}

static Future<String> parseTvName(String s) async {
Expand Down
8 changes: 6 additions & 2 deletions ui/lib/welcome_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ class WelcomePageState extends ConsumerState<WelcomePage> {
onPressed: () async {
if (uri == WelcomePage.routeMoivie) {
await APIs.downloadAllMovies().then((v) {
showSnakeBar("开始下载电影:$v");
if (v.isNotEmpty) {
showSnakeBar("开始下载电影:$v");
}
});
} else {
await APIs.downloadAllTv().then((v) {
showSnakeBar("开始下载剧集:$v");
if (v.isNotEmpty) {
showSnakeBar("开始下载剧集:$v");
}
});
}
},
Expand Down

0 comments on commit 8ce7045

Please sign in to comment.