Prevent crash when generating JSONString
The issue is discussed in rBBB4726ee0c9c05
This commit is contained in:
@@ -288,11 +288,9 @@ def ensureImageOutputDir(results_output_dir):
|
|||||||
|
|
||||||
|
|
||||||
def getResultJSONString(ctx, results):
|
def getResultJSONString(ctx, results):
|
||||||
import copy
|
|
||||||
# Convert custom classes to dictionaries for easier JSON dump.
|
# Convert custom classes to dictionaries for easier JSON dump.
|
||||||
json_results = copy.deepcopy(results)
|
results['schema_version'] = RESULT_JSON_SCHEMA_VERSION
|
||||||
json_results['schema_version'] = RESULT_JSON_SCHEMA_VERSION
|
stats = results['stats']
|
||||||
stats = json_results['stats']
|
|
||||||
for scene in ctx.scenes:
|
for scene in ctx.scenes:
|
||||||
if scene not in stats:
|
if scene not in stats:
|
||||||
continue
|
continue
|
||||||
@@ -301,7 +299,7 @@ def getResultJSONString(ctx, results):
|
|||||||
stats[scene]['result'] = 'OK'
|
stats[scene]['result'] = 'OK'
|
||||||
else:
|
else:
|
||||||
stats[scene] = {'result': 'CRASH'}
|
stats[scene] = {'result': 'CRASH'}
|
||||||
return json.dumps(json_results, sort_keys=True, indent=2)
|
return json.dumps(results, sort_keys=True, indent=2)
|
||||||
|
|
||||||
|
|
||||||
def saveResults(ctx, results, output_dir):
|
def saveResults(ctx, results, output_dir):
|
||||||
|
Reference in New Issue
Block a user