diff options
author | Ton Roosendaal <ton@blender.org> | 2003-12-08 19:46:36 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-12-08 19:46:36 +0300 |
commit | 23c1b0a7d4f92f2660ca9ec8cd2415edaa906b42 (patch) | |
tree | d8f9758eb2260d2878167e4c39d01ceb4147a4d6 /source/blender/src/editcurve.c | |
parent | aefb33e8cfde29609239b872d9adcefb4da78586 (diff) |
- bug report Theeth, #772
When joining 2 unconnected control points in Curve/Surface (FKEY) Blender
crashed.
Was just assuming in this code that a knots vector array was there...
simple fix!
BTW: I think Theeth discovered here the oldest Blender ever, I could
track it back to old Traces code from 1992. :)
Diffstat (limited to 'source/blender/src/editcurve.c')
-rw-r--r-- | source/blender/src/editcurve.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c index ceaaf27a12e..f2562627993 100644 --- a/source/blender/src/editcurve.c +++ b/source/blender/src/editcurve.c @@ -2392,19 +2392,24 @@ void addsegment_nurb() /* now join the knots */ if((nu1->type & 7)==4) { - fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3"); - memcpy(fp, nu1->knotsu, sizeof(float)*a); - MEM_freeN(nu1->knotsu); - nu1->knotsu= fp; - - - offset= nu1->knotsu[a-1] +1.0; - fp= nu1->knotsu+a; - for(a=0; a<nu2->pntsu; a++, fp++) { - if(nu2->knotsu) - *fp= offset+nu2->knotsu[a+1]; - else - *fp = offset; + if(nu1->knotsu==NULL) { + makeknots(nu1, 1, nu1->flagu>>1); + } + else { + fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3"); + memcpy(fp, nu1->knotsu, sizeof(float)*a); + MEM_freeN(nu1->knotsu); + nu1->knotsu= fp; + + + offset= nu1->knotsu[a-1] +1.0; + fp= nu1->knotsu+a; + for(a=0; a<nu2->pntsu; a++, fp++) { + if(nu2->knotsu) + *fp= offset+nu2->knotsu[a+1]; + else + *fp = offset; + } } } freeNurb(nu2); |