Crash on setting text via DSL.text(CharSequence)
- Lingua principale
- Java
- Stelle
- 1.4k
- Fork
- 89
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi. I'm trying to change the text in my view via `DSL.text(CharSequence)`. Sometimes text can be null, which seems to be incorrectly handled by library:
```
java.lang.IllegalArgumentException: method android.widget.TextView.setText argument 1 has type int, got null
at java.lang.reflect.Method.invoke(Native Method)
at trikita.anvil.PropertySetter.set(PropertySetter.java:106)
at trikita.anvil.Anvil$Mount$Iterator.attr(Anvil.java:331)
at trikita.anvil.BaseDSL.attr(BaseDSL.java:105)
at trikita.anvil.DSL.text(DSL.java:2141)
```
Crash happens around:
```java
if (value == null || assignable(arg, value.getClass())) {
m.invoke(v, value);
return true;
}
```
Clearly it happens because value is `null` and chosen method has signature for `int`, which is not checked.
I assume value type should be passed to `PropertySetter.set` explicitly to handle this issue gracefully.
Existing workaround is to set text to empty string instead of `null`.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.