Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-12-17 13:20:12 +0300
committerJulian Eisel <julian@blender.org>2020-12-17 13:24:08 +0300
commit6203a3ee684d704f2270edde4df80e2549d1a38d (patch)
tree88eb6cb02c3133eaa86c645e04a9c6699c3cca35
parent7e535499d5f691876a50aede97e52cbb07c3b636 (diff)
Fix T83878: Crash right-clicking in Asset Browser with no asset active
Data of the File Browser context callback needs to be validated and return `CTX_RESULT_NO_DATA` if the context member is valid but not set in the current context.
-rw-r--r--source/blender/editors/space_file/space_file.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 5bd7f6c17f6..774dc54700c 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -803,16 +803,25 @@ static int /*eContextResult*/ file_context(const bContext *C,
if (CTX_data_equals(member, "active_file")) {
FileDirEntry *file = filelist_file(sfile->files, params->active_file);
+ if (file == NULL) {
+ return CTX_RESULT_NO_DATA;
+ }
+
CTX_data_pointer_set(result, &screen->id, &RNA_FileSelectEntry, file);
return CTX_RESULT_OK;
}
if (CTX_data_equals(member, "id")) {
const FileDirEntry *file = filelist_file(sfile->files, params->active_file);
+ if (file == NULL) {
+ return CTX_RESULT_NO_DATA;
+ }
ID *id = filelist_file_get_id(file);
- if (id) {
- CTX_data_id_pointer_set(result, id);
+ if (id == NULL) {
+ return CTX_RESULT_NO_DATA;
}
+
+ CTX_data_id_pointer_set(result, id);
return CTX_RESULT_OK;
}