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:
authorCampbell Barton <ideasman42@gmail.com>2012-08-06 12:41:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-06 12:41:45 +0400
commitdf81b50bf2b250e09faae0af469e676203a4ff3e (patch)
tree8bfd5d72606e8f7b163624edf059a07351efd1c1 /source/blender/editors
parent5bb97305a4e47838dd2a89a250bd7e1c9528a6ca (diff)
prevent copy/paste from incompatible types (compo -> material for eg) - would crash instantly.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/node_edit.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index acbf0f09cc5..68806a802ac 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -46,9 +46,10 @@
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_node.h"
#include "BKE_material.h"
+#include "BKE_node.h"
#include "BKE_paint.h"
+#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_texture.h"
@@ -1918,6 +1919,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
/* clear current clipboard */
BKE_node_clipboard_clear();
+ BKE_node_clipboard_init(ntree);
/* get group node offset */
if (gnode)
@@ -1992,7 +1994,7 @@ void NODE_OT_clipboard_copy(wmOperatorType *ot)
/* ****************** Paste from clipboard ******************* */
-static int node_clipboard_paste_exec(bContext *C, wmOperator *UNUSED(op))
+static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
@@ -2003,6 +2005,11 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *UNUSED(op))
int num_nodes;
float centerx, centery;
+ if (BKE_node_clipboard_get_type() != ntree->type) {
+ BKE_report(op->reports, RPT_ERROR, "Clipboard nodes are an incompatible type");
+ return OPERATOR_CANCELLED;
+ }
+
ED_preview_kill_jobs(C);
/* deselect old nodes */