fix for 'blender -E' crashing.

This commit is contained in:
Campbell Barton
2011-09-11 13:46:58 +00:00
parent ab2fc6f106
commit 3d3f6b1ddc

View File

@@ -542,22 +542,17 @@ static int set_output(int argc, const char **argv, void *data)
static int set_engine(int argc, const char **argv, void *data) static int set_engine(int argc, const char **argv, void *data)
{ {
bContext *C = data; bContext *C = data;
if (argc >= 1) if (argc >= 2) {
{ if (!strcmp(argv[1], "help")) {
if (!strcmp(argv[1],"help"))
{
RenderEngineType *type = NULL; RenderEngineType *type = NULL;
printf("Blender Engine Listing:\n");
for( type = R_engines.first; type; type = type->next ) for( type = R_engines.first; type; type = type->next ) {
{
printf("\t%s\n", type->idname); printf("\t%s\n", type->idname);
} }
exit(0); exit(0);
} }
else else {
{ if (CTX_data_scene(C)==NULL) {
if (CTX_data_scene(C)==NULL)
{
printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n");
} }
else { else {
@@ -574,7 +569,7 @@ static int set_engine(int argc, const char **argv, void *data)
} }
else else
{ {
printf("\nEngine not specified.\n"); printf("\nEngine not specified, give 'help' for a list of available engines.\n");
return 0; return 0;
} }
} }