fix for crashes trying to resolve paths "location[]" or "location.."
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 Dec 2010 09:12:54 +0000 (09:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 Dec 2010 09:12:54 +0000 (09:12 +0000)
source/blender/makesrna/intern/rna_access.c

index db8710aec2ad31efcaddac6956b617b4ebd5f6c8..d8c4c67c68abd5f9fc8cf41d9c1772ae9155c32d 100644 (file)
@@ -3085,8 +3085,12 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
                                if (*path=='[') {
                                        token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
 
+                                       if(token==NULL) {
+                                               /* invalid syntax blah[] */
+                                               return 0;
+                                       }
                                        /* check for "" to see if it is a string */
-                                       if(rna_token_strip_quotes(token)) {
+                                       else if(rna_token_strip_quotes(token)) {
                                                *index= RNA_property_array_item_index(prop, *(token+1));
                                        }
                                        else {
@@ -3096,6 +3100,10 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
                                }
                                else {
                                        token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
+                                       if(token==NULL) {
+                                               /* invalid syntax blah.. */
+                                               return 0;
+                                       }
                                        *index= RNA_property_array_item_index(prop, *token);
                                }