Kotlin and Realm unexpected behavior


Hello everyone, i have got a situation when Android Studio allows me to compile this code. Is this behavior right? And can someone explain me how does it work?

Analyzer skips an obvious error and application crashes in a runtime

The problem is that you cannot use the spread operator on a nullable array.

This compiles because the RealmList constructor signature seems to be vararg objects: Any? so it accepts both the spread array or a null.

Note: This is all I can deduce from the limited information you provided


Thank you for your answer. I investigated this problem more deeper and wrote another post.