File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,17 +68,22 @@ class AppData with ChangeNotifier {
6868 Future <void > refreshFiles () async {
6969 if (currentTank.isEmpty ()) {
7070 _files = jsonDecode ('{"Error: Choose tank from menu":""}' );
71- } else {
72- var tcInterface = TcInterface .instance ();
73- // wait 15 seconds (the default of 5 seconds could be too little)
74- var value = await tcInterface.get (currentTank.ip, 'rootdir' , 15 );
71+ return ;
72+ }
73+ var tcInterface = TcInterface .instance ();
74+ var value = '' ;
75+ // wait 15 seconds (the default of 5 seconds could be too little)
76+ try {
77+ value = await tcInterface.get (currentTank.ip, 'rootdir' , 15 );
7578 while (value.substring (value.length - 1 ) == '\n ' ) {
7679 value = value.substring (0 , value.length - 1 );
7780 }
7881 value = value.replaceAll ('\n ' , '", "' );
7982 value = value.replaceAll ('\t ' , '":"' );
8083 value = '{"$value "}' ;
8184 _files = jsonDecode (value);
85+ } catch (e) {
86+ _files = jsonDecode ('{"Error: $e ":""}' );
8287 }
8388 notifyListeners ();
8489 }
You can’t perform that action at this time.
0 commit comments