Bug #3658 reported by Daniel Holtz (thanks):

http://projects.blender.org/tracker/?func=detail&atid=125&aid=3658&group_id=9

Running scripts from command line in bg mode:
blender -b -P myscript.py
crashes Blender 2.40.

The problem is in add_text() in text.c: G.scene can be NULL at this
point (in bg mode). Added a check:

line 323:
	if (G.scene) /* can be NULL (bg mode) */
		BLI_convertstringcode(str, G.sce, G.scene->r.cfra);

The text being added with add_text() in this particular case is the
script filename specified at the command prompt, so it should be ok to skip
BLI_convertstringcode. Feel free to disagree, though.
This commit is contained in:
Willian Padovani Germano 2006-01-06 20:15:18 +00:00
parent 37495aa211
commit b1c6fe7337

@ -320,7 +320,8 @@ Text *add_text(char *file)
char str[FILE_MAXDIR+FILE_MAXFILE]; char str[FILE_MAXDIR+FILE_MAXFILE];
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE); BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
BLI_convertstringcode(str, G.sce, G.scene->r.cfra); if (G.scene) /* can be NULL (bg mode) */
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
BLI_split_dirfile(str, sdir, sfile); BLI_split_dirfile(str, sdir, sfile);
fp= fopen(str, "r"); fp= fopen(str, "r");