fix to allow empty map for phone-number users

com.nextcloud.talk2  E  Failed to searchContactsByPhoneNumber
    java.lang.NullPointerException: Parameter specified as non-null is null: method com.nextcloud.talk.models.json.search.ContactsByNumberOCS.setMap, parameter <set-?>
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOCS.setMap(Unknown Source:2)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOCS$$JsonObjectMapper.parseField(ContactsByNumberOCS$$JsonObjectMapper.java:56)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOCS$$JsonObjectMapper.parse(ContactsByNumberOCS$$JsonObjectMapper.java:33)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOCS$$JsonObjectMapper.parse(ContactsByNumberOCS$$JsonObjectMapper.java:16)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOverall$$JsonObjectMapper.parseField(ContactsByNumberOverall$$JsonObjectMapper.java:40)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOverall$$JsonObjectMapper.parse(ContactsByNumberOverall$$JsonObjectMapper.java:30)
    	at com.nextcloud.talk.models.json.search.ContactsByNumberOverall$$JsonObjectMapper.parse(ContactsByNumberOverall$$JsonObjectMapper.java:13)
    	at com.bluelinelabs.logansquare.JsonMapper.parse(JsonMapper.java:52)
    	at com.bluelinelabs.logansquare.LoganSquare.parse(LoganSquare.java:69)
    	at com.github.aurae.retrofit2.LoganSquareResponseBodyConverter.convert(LoganSquareResponseBodyConverter.java:30)
    	at com.github.aurae.retrofit2.LoganSquareResponseBodyConverter.convert(LoganSquareResponseBodyConverter.java:16)
    	at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
    	at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
    	at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:46)
    	at io.reactivex.Observable.subscribe(Observable.java:12284)
    	at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
    	at io.reactivex.Observable.subscribe(Observable.java:12284)
    	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    	at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:608)
    	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
    	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    	at java.lang.Thread.run(Thread.java:919)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-07-06 13:41:59 +02:00
parent 79508e8ca0
commit 007c4a97dc

View file

@ -25,7 +25,6 @@ import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import com.nextcloud.talk.models.json.generic.GenericMeta
import java.util.HashMap
import kotlinx.parcelize.Parcelize
@Parcelize
@ -34,7 +33,7 @@ data class ContactsByNumberOCS(
@JsonField(name = ["meta"])
var meta: GenericMeta?,
@JsonField(name = ["data"])
var map: Map<String, String> = HashMap()
var map: Map<String, String>? = HashMap()
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, HashMap())