This repository has been archived by the owner on Nov 26, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this is the cause of the crash? Because it fallback to 0 if is nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not
nil
. It's3
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried on PR #237 because I am currently reviewing that and this is not happening, how do I reproduce that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't crash if you have different defaults already set for configuration. See this line:
https://github.com/FolioReader/FolioReaderKit/pull/237/files#diff-7d83fdc08c25740f0dc3bab59bd7c2bbL72
It sets the default value to
defaultVertical
. In this line it takes the default value if nothing has changed it:https://github.com/FolioReader/FolioReaderKit/pull/237/files#diff-21569209c801652e20649d5072f824d0R255
And then the conditional in this line does not get triggered:
https://github.com/FolioReader/FolioReaderKit/pull/237/files#diff-21569209c801652e20649d5072f824d0R255
Which means that when you reach this line:
https://github.com/FolioReader/FolioReaderKit/pull/237/files#diff-21569209c801652e20649d5072f824d0R255
scrollDirection
is stilldefaultVertical
, which has arawValue
of 3. There's only two segments so it crashes.I expect you have some unique state from developing the project that set your current scroll direction to either
horizontal
orvertical
. I think user defaults are maintained across app deletion, so to reproduce you would have to eitherThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you are right :)