// Do nothing, if there's no MediaAgent instance associated with page
// context.
if (mediaAgent != null) {
try {
mediaAgent.waitForComplete();
} catch (MediaAgentException e) {
logger.error("rendering-error", "CanvasElement", e);
throw new PAPIException(exceptionLocalizer.format(
"rendering-error", "CanvasElement"), e);