More crash fixes

This commit is contained in:
Grishka 2022-04-29 03:37:18 +03:00
parent 4e4b5fcfe4
commit 93fbc52f6a
4 changed files with 11 additions and 6 deletions

View File

@ -58,7 +58,7 @@ dependencies {
implementation 'me.grishka.litex:dynamicanimation:1.1.0-alpha03'
implementation 'me.grishka.litex:viewpager:1.0.0'
implementation 'me.grishka.litex:viewpager2:1.0.0'
implementation 'me.grishka.appkit:appkit:1.2.2'
implementation 'me.grishka.appkit:appkit:1.2.3'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.jsoup:jsoup:1.14.3'
implementation 'com.squareup:otto:1.3.8'

View File

@ -75,9 +75,14 @@ public abstract class MastodonAPIRequest<T> extends APIRequest<T>{
}
public MastodonAPIRequest<T> exec(String accountID){
account=AccountSessionManager.getInstance().getAccount(accountID);
domain=account.domain;
account.getApiController().submitRequest(this);
try{
account=AccountSessionManager.getInstance().getAccount(accountID);
domain=account.domain;
account.getApiController().submitRequest(this);
}catch(Exception x){
Log.e(TAG, "exec: this shouldn't happen, but it still did", x);
invokeErrorCallback(new MastodonErrorResponse(x.getLocalizedMessage(), -1));
}
return this;
}

View File

@ -1096,7 +1096,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
@Override
public String[] onGetAllowedMediaMimeTypes(){
if(instance.configuration!=null && instance.configuration.mediaAttachments!=null && instance.configuration.mediaAttachments.supportedMimeTypes!=null)
if(instance!=null && instance.configuration!=null && instance.configuration.mediaAttachments!=null && instance.configuration.mediaAttachments.supportedMimeTypes!=null)
return instance.configuration.mediaAttachments.supportedMimeTypes.toArray(new String[0]);
return new String[]{"image/jpeg", "image/gif", "image/png", "video/mp4"};
}

View File

@ -182,7 +182,7 @@ public class UiUtils{
String name=cursor.getString(0);
if(name!=null)
return name;
}
}catch(Throwable ignore){}
}
return uri.getLastPathSegment();
}