Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
Description
While fixing RT-26547 I went through the new 3D code in scenegraph and noticed some bugs regarding the null handling.
* Shape3D.java - throws NPE when CullFace is null
fix:
if (impl_isDirty(DirtyBits.NODE_CULLFACE)) {
- pgShape3D.setCullFace(getCullFace());
+ pgShape3D.setCullFace(getCullFace() == null ? CullFace.BACK : getCullFace());
}
* PointLight, AmbientLight - don't handle null Color correctly. The null value is actually handled in the scenegraph code, but it is passed to render tree and then NPE is thrown while rendering.
In the rest of the scenegraph we take following approach:
* in setters of properties we just use default value if the value given by user is null (because of the binding)
* in other methods (setters for values which are not properties, etc.). we throw NPE
* Shape3D.java - throws NPE when CullFace is null
fix:
if (impl_isDirty(DirtyBits.NODE_CULLFACE)) {
- pgShape3D.setCullFace(getCullFace());
+ pgShape3D.setCullFace(getCullFace() == null ? CullFace.BACK : getCullFace());
}
* PointLight, AmbientLight - don't handle null Color correctly. The null value is actually handled in the scenegraph code, but it is passed to render tree and then NPE is thrown while rendering.
In the rest of the scenegraph we take following approach:
* in setters of properties we just use default value if the value given by user is null (because of the binding)
* in other methods (setters for values which are not properties, etc.). we throw NPE