[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20177] trunk/blender/source/creator/ creator.c: Fix crash when missing int argument for -s -e and -j.

Martin Poirier theeth at yahoo.com
Wed May 13 01:41:46 CEST 2009


Revision: 20177
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20177
Author:   theeth
Date:     2009-05-13 01:41:46 +0200 (Wed, 13 May 2009)

Log Message:
-----------
Fix crash when missing int argument for -s -e and -j.

Modified Paths:
--------------
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2009-05-12 21:41:04 UTC (rev 20176)
+++ trunk/blender/source/creator/creator.c	2009-05-12 23:41:46 UTC (rev 20177)
@@ -662,7 +662,8 @@
 				a++;
 				if (G.scene) {
 					if (a < argc) {
-						int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
+						int frame = atoi(argv[a]);
+						frame = MIN2(MAXFRAME, MAX2(1, frame));
 						Render *re= RE_NewRender(G.scene->id.name);
 #ifndef DISABLE_PYTHON
 						if (G.f & G_DOSCRIPTLINKS)
@@ -701,8 +702,10 @@
 			case 's':
 				a++;
 				if(G.scene) {
-					int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
-					if (a < argc) (G.scene->r.sfra) = frame;
+					if (a < argc) {
+						int frame = atoi(argv[a]);
+						(G.scene->r.sfra) = MIN2(MAXFRAME, MAX2(1, frame));
+					}
 				} else {
 					printf("\nError: no blend loaded. cannot use '-s'.\n");
 				}
@@ -710,8 +713,10 @@
 			case 'e':
 				a++;
 				if(G.scene) {
-					int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
-					if (a < argc) (G.scene->r.efra) = frame;
+					if (a < argc) {
+						int frame = atoi(argv[a]);
+						(G.scene->r.efra) = MIN2(MAXFRAME, MAX2(1, frame));
+					}
 				} else {
 					printf("\nError: no blend loaded. cannot use '-e'.\n");
 				}
@@ -719,8 +724,10 @@
 			case 'j':
 				a++;
 				if(G.scene) {
-					int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
-					if (a < argc) (G.scene->frame_step) = fstep;
+					if (a < argc) {
+						int frame = atoi(argv[a]);
+						(G.scene->frame_step) = MIN2(MAXFRAME, MAX2(1, frame));
+					}
 				} else {
 					printf("\nError: no blend loaded. cannot use '-j'.\n");
 				}





More information about the Bf-blender-cvs mailing list