java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Number.longValue()' on a null object reference
See original GitHub issueDBFlow Version: 4.1.1
Issue Kind (Bug, Question, Feature): Bug
Description: after update from 4.0.5 to 4.1.1 i have this error
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Number.longValue()' on a null object reference 09-05 14:50:01.977 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.structure.ModelAdapter.hasAutoIncrement(ModelAdapter.java:316) 09-05 14:50:01.978 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.sql.saveable.AutoIncrementModelSaver.insert(AutoIncrementModelSaver.java:49) 09-05 14:50:01.978 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save(ModelSaver.java:51) 09-05 14:50:01.978 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save(ModelSaver.java:35) 09-05 14:50:01.978 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.structure.ModelAdapter.save(ModelAdapter.java:190) 09-05 14:50:01.978 3481-3481/* W/System.err: at com.raizlabs.android.dbflow.structure.BaseModel.save(BaseModel.java:68)
and field with @ForeignKey(saveForeignKeyModel = true)
and autoincrement primary key. In 4.0.5 all working fine. In patch-notes i can`t find any changes about it behavior
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
Top GitHub Comments
or simply…
I noticed this recently too. If you initialize your auto incrementing primary key to some value, say 0, I think that works around this. Something like this