Avoid a crash when max_char defined by the instance is not an integer

This commit is contained in:
Thomas 2025-05-27 08:06:16 +02:00
parent 749aefe858
commit 02a066a253

View file

@ -559,7 +559,7 @@ public class MastodonHelper {
return val;
} else {
if (instanceInfo != null) {
max_car = instanceInfo.max_toot_chars != null ? Integer.parseInt(instanceInfo.max_toot_chars) : instanceInfo.configuration.statusesConf.max_characters;
max_car = instanceInfo.max_toot_chars != null && instanceInfo.max_toot_chars.matches("\\d+") ? Integer.parseInt(instanceInfo.max_toot_chars) : instanceInfo.configuration.statusesConf.max_characters;
} else {
max_car = 500;
}