Closed edgarogh closed 2 months ago
That's interesting. It should not be possible for this field to be null because it has an annotation that it's required:
https://github.com/mastodon/mastodon-android/blob/2c9e92a254907772757cdc932fd37667fc9218bb/mastodon/src/main/java/org/joinmastodon/android/model/Status.java#L24-L25
The validation happens after the response is parsed and before any further processing, and if any field with this annotation in any part of the response is null, it's treated like a network error, so it's really odd that this malformed object somehow gets this far. So it clearly must be a bug in the compiler, the Android runtime, the Linux kernel, the CPU in your phone, or the laws of physics, no way it is a bug in my code, it can't possibly be.
I need more details to try to reproduce this. What server are you using?
The problem was between my chair bed and my phone's screen, surprisingly. I had this issue on a fork of the app which removed the annotation for some reason. Before reporting it on their repository, I tried to test it on the upstream app (this one) to see if it also happened here, and I must've completely messed up my test because I was sure I managed to get the Mastodon app to crash. I just double checked and indeed, fortunately, none of the compiler, ART, CPU or laws or physics are broken. Mastodon doesn't crash, and properly displays an error message. This still means that my timeline is effectively broken on all major apps as of right now, but since I'm using a pleroma instance, their broken API/validation is none of your responsibility.
Sorry for the inconvenience, and have a good week-end!
The app crashes immediately when started. It just started happening so I suppose it's caused by a malformed toot JSON. Whether or not the server (instance) is in the wrong or not, it shouldn't be possible for a server to remotely crash a client app.
Relevant code: https://github.com/mastodon/mastodon-android/blob/2c9e92a254907772757cdc932fd37667fc9218bb/mastodon/src/main/java/org/joinmastodon/android/api/CacheController.java#L132