Skip to content

Commit 6be50d6

Browse files
ToOne: only access boxStore once known to be non-null (fix NPE).
#516
1 parent ff4e53d commit 6be50d6

File tree

1 file changed

+1
-1
lines changed
  • objectbox-java/src/main/java/io/objectbox/relation

1 file changed

+1
-1
lines changed

objectbox-java/src/main/java/io/objectbox/relation/ToOne.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ private void ensureBoxes(TARGET target) {
112112
Field boxStoreField = ReflectionCache.getInstance().getField(entity.getClass(), "__boxStore");
113113
try {
114114
boxStore = (BoxStore) boxStoreField.get(entity);
115-
debugRelations = boxStore.isDebugRelations();
116115
if (boxStore == null) {
117116
if (target != null) {
118117
boxStoreField = ReflectionCache.getInstance().getField(target.getClass(), "__boxStore");
@@ -123,6 +122,7 @@ private void ensureBoxes(TARGET target) {
123122
"call box.attach(entity) beforehand.");
124123
}
125124
}
125+
debugRelations = boxStore.isDebugRelations();
126126
} catch (IllegalAccessException e) {
127127
throw new RuntimeException(e);
128128
}

0 commit comments

Comments
 (0)