diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-12-17 11:12:00 +0200 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-12-17 11:12:00 +0200 |
commit | 5ddf3390602b828a128d62b53cbf03316305af3b (patch) | |
tree | 587daeee3e19ecfb94492904a1dcb6fdde5bd043 /src/net/java/sip/communicator/impl/osdependent/jdic | |
parent | a2ac6e081c44681aeff8052e1a4ebcdacb8ff252 (diff) | |
download | jitsi-5ddf3390602b828a128d62b53cbf03316305af3b.zip jitsi-5ddf3390602b828a128d62b53cbf03316305af3b.tar.gz jitsi-5ddf3390602b828a128d62b53cbf03316305af3b.tar.bz2 |
Fixes an issue with missing or corrupt images which could cause the whole user interface of the application or parts of it to not appear at all.
Diffstat (limited to 'src/net/java/sip/communicator/impl/osdependent/jdic')
-rw-r--r-- | src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java index b232f5d..0e3625f 100644 --- a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java +++ b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java @@ -177,49 +177,50 @@ public class StatusSelector public void updateStatus(PresenceStatus presenceStatus) { + String presenceStatusName = presenceStatus.getStatusName(); + if (logger.isTraceEnabled()) - logger.trace("Systray update status for provider: " - + provider.getAccountID().getAccountAddress() - + ". The new status will be: " + presenceStatus.getStatusName()); + { + logger.trace( + "Systray update status for provider: " + + provider.getAccountID().getAccountAddress() + + ". The new status will be: " + + presenceStatusName); + } if (menu instanceof AbstractButton) - ((AbstractButton) menu).setIcon(new ImageIcon(presenceStatus - .getStatusIcon())); + { + byte[] bytes = presenceStatus.getStatusIcon(); + + if (bytes != null) + ((AbstractButton) menu).setIcon(new ImageIcon()); + } if(menu instanceof Menu) { Menu theMenu = (Menu) menu; - for(int i =0; i < theMenu.getItemCount(); i++) + + for(int i = 0, count = theMenu.getItemCount(); i < count; i++) { MenuItem item = theMenu.getItem(i); if(item instanceof CheckboxMenuItem) { - if(item.getLabel().equals(presenceStatus.getStatusName())) - { - ((CheckboxMenuItem)item).setState(true); - } - else - { - ((CheckboxMenuItem)item).setState(false); - } + ((CheckboxMenuItem) item).setState( + item.getLabel().equals(presenceStatusName)); } } } else if(menu instanceof JMenu) { JMenu theMenu = (JMenu) menu; - for(int i =0; i < theMenu.getItemCount(); i++) + + for(int i = 0, count = theMenu.getItemCount(); i < count; i++) { JMenuItem item = theMenu.getItem(i); if(item instanceof JCheckBoxMenuItem) - { - if(item.getText().equals(presenceStatus.getStatusName())) - item.setSelected(true); - else - item.setSelected(false); - } + item.setSelected(item.getText().equals(presenceStatusName)); } } } |