Ehviewer-Overhauled / Ehviewer

EhViewer overhauled with Material Design 3, Jetpack Compose and more
GNU General Public License v3.0
5.08k stars 234 forks source link

Advance option's page text field related crash #1367

Closed 5idereal closed 10 months ago

5idereal commented 10 months ago

复现步骤 / Step to reproduce

  1. Enable advance options
  2. Enter space, dash in the pages text field, or clear the input.

预期行为 / Expected behaviour

Prevent users from entering spaces or dashes, and handle exceptions when the text field is empty.

实际行为 / Actual Behaviour

Crashes.

应用日志 / App logs

FATAL EXCEPTION: main Process: moe.tarsin.ehviewer.debug, PID: 6598 java.lang.NumberFormatException: For input string: "" at java.lang.Integer.parseInt(Integer.java:757) at java.lang.Integer.parseInt(Integer.java:865) at com.hippo.ehviewer.ui.main.AdvancedSearchKt$SearchAdvanced$1$1$4$3$1.invoke(AdvancedSearch.kt:102) at com.hippo.ehviewer.ui.main.AdvancedSearchKt$SearchAdvanced$1$1$4$3$1.invoke(AdvancedSearch.kt:102) at androidx.compose.foundation.text.BasicTextFieldKt$BasicTextField$4$1.invoke(BasicTextField.kt:170) at androidx.compose.foundation.text.BasicTextFieldKt$BasicTextField$4$1.invoke(BasicTextField.kt:163) at androidx.compose.foundation.text.TextFieldState$onValueChange$1.invoke(CoreTextField.kt:901) at androidx.compose.foundation.text.TextFieldState$onValueChange$1.invoke(CoreTextField.kt:896) at androidx.compose.foundation.text.TextFieldKeyInput.apply(TextFieldKeyInput.kt:71) at androidx.compose.foundation.text.TextFieldKeyInput.access$apply(TextFieldKeyInput.kt:50) at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.kt:134) at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.kt:106) at androidx.compose.foundation.text.TextFieldKeyInput.commandExecutionContext(TextFieldKeyInput.kt:226) at androidx.compose.foundation.text.TextFieldKeyInput.process-ZmokQxo(TextFieldKeyInput.kt:106) at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke-ZmokQxo(TextFieldKeyInput.kt:261) at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke(TextFieldKeyInput.kt:261) at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80) at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:199) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:676) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:488) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1895) at android.app.Activity.dispatchKeyEvent(Activity.java:4223) at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120) at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138) at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604) at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60) at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:402) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6584) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6450) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5910) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)

备注 / Addition details

No response

EhViewer 版本号 / EhViewer version code

1.8.9.0-SNAPSHOT

EhViewer CI 版本 / EhViewer CI Version

25f14ec

Android 系统版本 / Android version

One UI 5.1

设备型号 / Device model

Galaxy A71

SoC 型号 / Soc model

Snapdragon 730

自查步骤 / Verify steps

FooIbar commented 10 months ago

Fixed by https://github.com/FooIbar/EhViewer/commit/ea93960bf415fe3fe6cb4c22905378980f14c011