Fix a crash when instance is null

pull/946/head
Thomas 1 year ago
parent 50e88b3f86
commit 14bd5e9750

@ -1114,7 +1114,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
.proxy(Helper.getProxy(getApplication().getApplicationContext())) .proxy(Helper.getProxy(getApplication().getApplicationContext()))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(MainActivity.currentInstance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (MainActivity.currentInstance != null ? IDN.toASCII(MainActivity.currentInstance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

@ -62,7 +62,7 @@ public class TimelineHelper {
.proxy(Helper.getProxy(context)) .proxy(Helper.getProxy(context))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(BaseMainActivity.currentInstance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (MainActivity.currentInstance != null ? IDN.toASCII(MainActivity.currentInstance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

Loading…
Cancel
Save