From 028820868fe1a0753b2918ce1ee31c5b34530eac Mon Sep 17 00:00:00 2001 From: Samuel Cardoso Date: Tue, 5 Jan 2016 11:01:23 -0200 Subject: [PATCH] Issue #729 - File Uploader is throwing an exception when uploading image files --- .../widgets/client/uploader/AbstractFileUploader.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cruxframework/crux/widgets/client/uploader/AbstractFileUploader.java b/src/main/java/org/cruxframework/crux/widgets/client/uploader/AbstractFileUploader.java index 8bf4a59..007cd98 100644 --- a/src/main/java/org/cruxframework/crux/widgets/client/uploader/AbstractFileUploader.java +++ b/src/main/java/org/cruxframework/crux/widgets/client/uploader/AbstractFileUploader.java @@ -530,7 +530,16 @@ protected ProgressBar createProgressBar() protected ProgressBar getProgressBar(String fileName) { FlowPanel filePanel = filePanelWidgets.get(fileName); - ProgressBar progressBar = (ProgressBar) filePanel.getWidget(filePanel.getWidgetCount()-1); + ProgressBar progressBar = null; + Widget widget = filePanel.getWidget(filePanel.getWidgetCount()-1); + if(widget instanceof ProgressBar) + { + progressBar = (ProgressBar) widget; + } + else + { + progressBar = (ProgressBar) filePanel.getWidget(filePanel.getWidgetCount()-2); + } return progressBar; }