Merge "Guard against a possible NPE when the rendering fails." into tools_r12