Fix crosspost crash on startup #2691
Conversation
The logic flow before was: Check if json does not have crosspost_parent_list AND get member 0 of json's crosspost_parent_list to check if it's not null The problem is if the first condition is true(json does not have crosspost_parent_list), AND can't short-circut and it will move on to evaluate the second side, so it will try and get member 0 of a crosspost_parent_list, which will be null as we figured out in the first conditional. Now the logic flow is: Check if json does not have crosspost_parent_list OR get member 0 of json's crosspost_parent_list to check if it's null This way, the OR can short circut on the first true condition, so the get member 0 logic won't trigger unless the json does have crosspost_parent_list.
This same fix exists in my Android P pull request #2681 For a compare and contrast in case we did anything different. |
Updating Google Play has caused issues in the past, have you done any testing with the updated Drive library for this PR? Also I believe running gradle in parallel breaks our CI, any reason we should leave that enabled (might be a better question for @Alexendoo)? Thank you for the PR @USA-RedDragon ! |
I didn't mean to merge the second commit. I'll go and reset HEAD and remake the pull request since Github is weird like that |
@USA-RedDragon git reset --hard HEAD^ | git push -f origin Fast forwards. The way to live. |
Gerrit is my poison of choice, so GitHub seems archaic now. Fast forwards are evil lol |
There we go. Removed the personal commit |
Thank you for the fix, will merge this now :) |
I don't think it would break CI but if it does I can take a look at it, what was the change exactly @ccrama? |
@Alexendoo the change was removed so no worries! We will have to update travis for @PiwwowPants #2681 though, probably going to merge that today or tomorrow as I've been testing for a week with no real issues yet |
The logic flow before was:
Check if json does not have crosspost_parent_list AND
get member 0 of json's crosspost_parent_list to check if it's not null
The problem is if the first condition is true(json does not have crosspost_parent_list),
AND can't short-circut and it will move on to evaluate the second side, so it will
try and get member 0 of a crosspost_parent_list, which will be null as we figured out
in the first conditional.
Now the logic flow is:
Check if json does not have crosspost_parent_list OR
get member 0 of json's crosspost_parent_list to check if it's null
This way, the OR can short circut on the first true condition, so the get member 0
logic won't trigger unless the json does have crosspost_parent_list.