diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-02-14 18:13:25 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-02-14 18:13:25 +0300 |
commit | 0999a01b03d4ee727ff73661ec35c8c169926689 (patch) | |
tree | 9bed84a9f9841f3e128558b684854f218506867f /source/blender/editors | |
parent | 65d4c58060eae4f544e4e483a38ca2b8d30bd707 (diff) |
Fix T95320: CacheFile templates crash when used through Python
The crash is caused as we did not check that the RNA pointer is null
before trying to use it. This moves the existing checks from the
modifier panels into the template functions so the logic is a bit
centralized.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8330f8c0db7..6a5d8d17af7 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6397,6 +6397,10 @@ void uiTemplateNodeSocket(uiLayout *layout, bContext *UNUSED(C), float color[4]) void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6406,6 +6410,10 @@ void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6452,6 +6460,10 @@ void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerR void uiTemplateCacheFileTimeSettings(uiLayout *layout, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6502,6 +6514,10 @@ uiListType *UI_UL_cache_file_layers() void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); |