refactor: deprecate redundant non-null on user agent#432
Open
yhkee0404 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extends #73 that fixes #70 where
getStringValuewould have thrownNullPointerExceptionbecause its return typeStringdid not allownullwhichconfig.getString(key)could indeed return.pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Lines 141 to 150 in 4575859
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Lines 222 to 223 in 4575859
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Line 60 in 4575859
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Line 47 in 4575859
That is why this null check has been added since #73:
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Lines 60 to 64 in 622def3
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Line 47 in 622def3
However, it has become deprecated since #387 because
getStringValuehas started to prevent the exception by returningString?instead of justStringwith its null return being typecast into an empty string.pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Line 271 in 240d0b2
pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Lines 456 to 457 in 240d0b2
In fact, we do not even need the typecast as well if we also make
userAgentConfignullable as it has been allowed since #73.pixel-volte-patch/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Line 77 in 240d0b2
You can download and test the built apk here but need to uninstall the previous release if any: https://github.com/yhkee0404/pixel-volte-patch/releases/tag/1.3.1_PR_426_430_431_432