From c0ecbfce0ec729164d93bc01d2ac8a485608770c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 15 Jan 2009 18:06:06 +0000 Subject: [PATCH] blender was crashing if no argument was given after '-t' mesh.faces.deltete(...) with an empty list no longer returns an error. --- source/blender/python/api2_2x/Mesh.c | 6 +++--- source/blender/render/intern/source/pipeline.c | 2 +- source/creator/creator.c | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 32ddb464c88..42c80728bab 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -5390,9 +5390,9 @@ static PyObject *MFaceSeq_delete( BPy_MFaceSeq * self, PyObject *args ) /* see how many args we need to parse */ len = PySequence_Size( args ); - if( len < 1 ) - return EXPP_ReturnPyObjError( PyExc_TypeError, - "sequence must contain at least one int or MFace" ); + if( len < 1 ) { + Py_RETURN_NONE; + } face_table = MEM_callocN( len*sizeof( unsigned int ), "face_table" ); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9ef9c2f3859..5c3c954aa8e 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2710,7 +2710,7 @@ void RE_set_max_threads(int threads) } else if(threads>=1 && threads<=BLENDER_MAX_THREADS) { commandline_threads= threads; } else { - printf("Error, threads has to be in range 1-%d\n", BLENDER_MAX_THREADS); + printf("Error, threads has to be in range 0-%d\n", BLENDER_MAX_THREADS); } } diff --git a/source/creator/creator.c b/source/creator/creator.c index a6111210593..9d6841c3708 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -785,10 +785,14 @@ int main(int argc, char **argv) case 't': a++; - if(G.background) { - RE_set_max_threads(atoi(argv[a])); + if (a < argc) { + if(G.background) { + RE_set_max_threads(atoi(argv[a])); + } else { + printf("Warning: threads can only be set in background mode\n"); + } } else { - printf("Warning: threads can only be set in background mode\n"); + printf("\nError: you must specify a number of threads between 0 and 8 '-t '.\n"); } break; case 'x': /* extension */