Skip to content

Commit 2400fff

Browse files
amartya4256fedejeanne
authored andcommitted
Add exception to setImageMetadataForHandle
This commit adds a check for imageMetadata for handle in case, there already exists an entry in the zoomLeveltoImageHandle map for a zoom level and it must throw an exception in that case. contributes to #62 and #127
1 parent 5db1843 commit 2400fff

File tree

1 file changed

+5
-2
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+5
-2
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,9 +1788,12 @@ else if (i.alphaData != null) {
17881788
}
17891789

17901790
private void setImageMetadataForHandle(ImageHandle imageMetadata, Integer zoom) {
1791-
if (zoom != null && !zoomLevelToImageHandle.containsKey(zoom)) {
1792-
zoomLevelToImageHandle.put(zoom, imageMetadata);
1791+
if (zoom == null)
1792+
return;
1793+
if (zoomLevelToImageHandle.containsKey(zoom)) {
1794+
SWT.error(SWT.ERROR_ITEM_NOT_ADDED);
17931795
}
1796+
zoomLevelToImageHandle.put(zoom, imageMetadata);
17941797
}
17951798

17961799
static long [] init(Device device, Image image, ImageData source, ImageData mask, Integer zoom) {

0 commit comments

Comments
 (0)