Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullpointer exception when calling SignalServiceMessageReceiver.retrieveMessages(..) due to updatedPni field #32

Open
jimhh opened this issue Jan 9, 2023 · 1 comment

Comments

@jimhh
Copy link

jimhh commented Jan 9, 2023

I get a Null Pointer Exception when receiving messages, and thus cannot receive any messages.

It happens under SignalServiceMessageReceiver.retrieveMessages(..) when the received envelope has null for entity.getUpdatedPni(). When this is null the Envelop.Builder will fail when calling .setUpdatedPni(updatedPni) since for some reason it is using the String value to make the call value.getClass(). I would guess this is generated code based on the protobuf stuff. So, a non-null check would be needed before this, unless the problem lies elsewhere.

I can't really say why it is null. I send a message from my phone and receive it with my bot.
Perhaps the deserialization is incorrectly configured to interpret missing data as null, the field is optional.

optional string updatedPni = 15;

The signal-client "lib" code in the adroid app does not set the updatedPni argument

envelope = new SignalServiceEnvelope(entity.getType(),
                                             Optional.of(address),
                                             entity.getSourceDevice(),
                                             entity.getTimestamp(),
                                             entity.getContent(),
                                             entity.getServerTimestamp(),
                                             messageResult.getServerDeliveredTimestamp(),
                                             entity.getServerUuid(),
                                             entity.getDestinationUuid(),
                                             entity.isUrgent(),
                                             entity.isStory());

I may have done something wrong, however I can't see what that would be.

@AsamK
Copy link
Collaborator

AsamK commented Jan 21, 2023

Signal-Android doesn't use this forked library and the updatedPni field is an addition here. You could check the signal-cli code if that does something differently: https://github.com/AsamK/signal-cli/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants