avoid a crash with old peertube instances

This commit is contained in:
Thomas 2023-01-28 15:49:28 +01:00
parent 9683fee1e6
commit 3f1af73b0e
3 changed files with 7 additions and 6 deletions

View file

@ -33,6 +33,8 @@ import android.webkit.URLUtil;
import androidx.documentfile.provider.DocumentFile; import androidx.documentfile.provider.DocumentFile;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.gson.JsonSyntaxException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -1188,9 +1190,9 @@ public class RetrofitPeertubeAPI {
} }
throw error; throw error;
} }
} catch (IOException e) { } catch (IOException | JsonSyntaxException e) {
Error error = new Error(); Error error = new Error();
error.setError(_context.getString(R.string.toast_error)); error.setError(_context.getString(R.string.toast_error_peertube_not_supported));
apiResponse.setError(error); apiResponse.setError(error);
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="compose_shortcut_short_label1">Compose</string>
</resources>

View file

@ -2228,4 +2228,7 @@
<string name="action_change_subscribed_language">Change subscribed languages</string> <string name="action_change_subscribed_language">Change subscribed languages</string>
<string name="filter_languages">Filter languages</string> <string name="filter_languages">Filter languages</string>
<string name="translate_in">Translate in</string> <string name="translate_in">Translate in</string>
<string name="compose_shortcut_short_label1">Compose</string>
<string name="toast_error_peertube_not_supported">Your Peertube is too old and cannot be supported by the app.</string>
</resources> </resources>