From: dooglus Date: Sun, 21 Oct 2007 22:30:39 +0000 (+0000) Subject: Reject invalid and dangerous values for the 'step' parameter. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e13130619534dd014f1e41cefe89f0270e3169d0;p=synfig.git Reject invalid and dangerous values for the 'step' parameter. git-svn-id: http://svn.voria.com/code@942 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index bd628a7..4f10df9 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -217,6 +217,7 @@ Plant::sync()const Real f; int i=0, branch_count = 0, steps = round_to_int(1.0/step); + if (steps < 1) steps = 1; for(f=0.0;f<1.0;f+=step,i++) { Point point(curve(f)); @@ -273,7 +274,15 @@ Plant::set_param(const String & param, const ValueBase &value) IMPORT_PLUS(gradient,needs_sync_=true); IMPORT_PLUS(velocity,needs_sync_=true); IMPORT_PLUS(perp_velocity,needs_sync_=true); - IMPORT_PLUS(step,needs_sync_=true); + IMPORT_PLUS(step,{ + needs_sync_ = true; + if (step <= 0) + step=0.01; // user is probably clueless - give a good default + else if (step < 0.00001) + step=0.00001; // 100K should be enough for anyone + else if (step > 1) + step=1; + }); IMPORT_PLUS(splits,needs_sync_=true); IMPORT_PLUS(sprouts,needs_sync_=true); IMPORT_PLUS(random_factor,needs_sync_=true);