Skip to content

CRASH - When calling python function from invalid context/changing world #102

Description

@Dariusz1989

Hey

When I set scene via python api, the current scene may have an invalid world for some period of time...
``
@Persistent
def frame_change_handler(scene, depsgraph):
"""
Frame change handler, that redraws the atmosphere if and when
the scene has changed.
"""

if not scene.world or bpy.context.scene.world.psa_exposed.sun_object is None:
	return

Will crashm as bpy.context.scene has no world. 

if not scene.world or bpy.context.scene.world.psa_exposed.sun_object is None:
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'psa_exposed'


We also need to check if current context scene word is valid...


**General information**
4.5.0

**To Reproduce**
Tricky...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions