fix(Settings): Safe-guard connection test headers map cast

This commit is contained in:
Jagandeep Brar
2021-04-27 16:14:56 -05:00
parent d287a3e8a9
commit 08b39bcf8a
3 changed files with 7 additions and 5 deletions

View File

@@ -135,7 +135,7 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
Radarr(
host: _profile.radarrHost,
apiKey: _profile.radarrKey,
headers: Map<String, dynamic>.from(_profile.radarrHeaders),
headers: Map<String, dynamic>.from(_profile.radarrHeaders ?? {}),
)
.system
.status()

View File

@@ -147,7 +147,8 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
Sonarr(
host: _profile.sonarrHost,
apiKey: _profile.sonarrKey,
headers: Map<String, dynamic>.from(_profile.sonarrHeaders))
headers:
Map<String, dynamic>.from(_profile.sonarrHeaders ?? {}))
.system
.getStatus()
.then((_) => showLunaSuccessSnackBar(

View File

@@ -113,14 +113,14 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
icon: Icons.wifi_tethering_rounded,
onTap: () async {
ProfileHiveObject _profile = Database.currentProfileObject;
if (_profile.tautulliHost == null || _profile.tautulliHost.isEmpty) {
if (_profile?.tautulliHost?.isEmpty ?? true) {
showLunaErrorSnackBar(
title: 'Host Required',
message: 'Host is required to connect to Tautulli',
);
return;
}
if (_profile.tautulliKey == null || _profile.tautulliKey.isEmpty) {
if (_profile?.tautulliKey?.isEmpty ?? true) {
showLunaErrorSnackBar(
title: 'API Key Required',
message: 'API key is required to connect to Tautulli',
@@ -130,7 +130,8 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
Tautulli(
host: _profile.tautulliHost,
apiKey: _profile.tautulliKey,
headers: Map<String, dynamic>.from(_profile.tautulliHeaders))
headers:
Map<String, dynamic>.from(_profile?.tautulliHeaders ?? {}))
.miscellaneous
.arnold()
.then((_) => showLunaSuccessSnackBar(