Fix a crash when instance is null

This commit is contained in:
Thomas 2023-08-23 09:35:35 +02:00
parent 50e88b3f86
commit 14bd5e9750
2 changed files with 2 additions and 2 deletions

View File

@ -1114,7 +1114,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
.proxy(Helper.getProxy(getApplication().getApplicationContext()))
.build();
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()))
.client(okHttpClient)
.build();

View File

@ -62,7 +62,7 @@ public class TimelineHelper {
.proxy(Helper.getProxy(context))
.build();
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())
.client(okHttpClient)
.build();