Error: cannot read property 'replace' of null

Error: cannot read property 'replace' of null

by Péter Lukács -
Number of replies: 4

Moodle 3.5.2+, Mobile app 3.5.2. Airnotifier properly configured.

I used SAML2 SSO addon for authentication. After logged in, when i click on 'Notifications' the attacked 'Error: cannot read property 'replace' of null' error pops up.

I fixed this issue with removing the existing user and logging in as new... any clues?


Attachment Screenshot_2018-09-19-13-03-46-273_com.moodle.moodlemobile.png
Average of ratings: -
In reply to Péter Lukács

Re: Error: cannot read property 'replace' of null

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Péter,

I looked at the code and there are several places where we call 'replace', but I think that the one that affected you could be this one:

notification.mobiletext.replace(/-{4,}/ig, '');

Maybe the app didn't receive the "mobiletext" property of one notification? It's  weird that it was fixed by removing the data :/

Cheers,

Dani

In reply to Dani Palou

Re: Error: cannot read property 'replace' of null

by ARTEAGA Rodrigo -
I have the exact same issue. Just installed the mobile app and was working fine. I hope to find a few answers.
In reply to ARTEAGA Rodrigo

Re: Error: cannot read property 'replace' of null

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi Rodrigo,

Does this happen in a custom app but not in the official app?

When does the error appear exactly?

Cheers,
Dani
In reply to Dani Palou

Re: Error: cannot read property 'replace' of null

by ARTEAGA Rodrigo -

Hello Dani

I am using the official Moodle App. I just downloaded it to my Android, so it is updated. It worked one day and then on the second day, it began giving this error.   


I noticed that it appears when I click on reload button to check for new notifications. But it also happened when there were notifications and I clicked on the notification bell icon. 

Thank you very much for your help, 

Rodrigo