diff --git a/print/src/org/compiere/print/layout/ImageElement.java b/print/src/org/compiere/print/layout/ImageElement.java index 69ed30033f..eaeee39c1f 100644 --- a/print/src/org/compiere/print/layout/ImageElement.java +++ b/print/src/org/compiere/print/layout/ImageElement.java @@ -224,8 +224,8 @@ public class ImageElement extends PrintElement if (m_image == null) return true; // we have an image - waitForLoad(m_image); - if (m_image != null) + // if the image was not loaded, consider that there is no image - teo_sarca [ 1674706 ] + if (waitForLoad(m_image) && m_image != null) { p_width = m_image.getWidth(this); p_height = m_image.getHeight(this); @@ -253,6 +253,12 @@ public class ImageElement extends PrintElement p_width = (float) m_scaleFactor * p_width; p_height = (float) m_scaleFactor * p_height; } + // If the image is not loaded set it to null. + // This prevents SecurityException when invoking getWidth() or getHeight(). - teo_sarca [ 1674706 ] + else { + m_image = null; + } + return true; } // calculateSize diff --git a/print/src/org/compiere/print/layout/TableElement.java b/print/src/org/compiere/print/layout/TableElement.java index cf8bb2a97d..ba2edc5718 100644 --- a/print/src/org/compiere/print/layout/TableElement.java +++ b/print/src/org/compiere/print/layout/TableElement.java @@ -1354,7 +1354,7 @@ public class TableElement extends PrintElement else if (printItems[index] instanceof ImageElement) { Image imageToDraw = ((ImageElement)printItems[index]).getImage(); - if (imageToDraw.getHeight((ImageElement)printItems[index]) != -1) + if (imageToDraw != null) // teo_sarca [ 1674706 ] { // Draw image using the scale factor - teo_sarca, [ 1673548 ] Image is not scaled in a report table cell double scale = ((ImageElement)printItems[index]).getScaleFactor();