aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/replacement
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-11-09 14:14:47 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-11-09 14:14:47 +0000
commit76b3a4ad16bd330cfa1d326eecdcae8a10db03fb (patch)
treed83156dd37121e5d307622fa00acc406e620e080 /src/net/java/sip/communicator/impl/replacement
parent4f646deee90632ede047475eb57b9e8aa9b1bdfa (diff)
downloadjitsi-76b3a4ad16bd330cfa1d326eecdcae8a10db03fb.zip
jitsi-76b3a4ad16bd330cfa1d326eecdcae8a10db03fb.tar.gz
jitsi-76b3a4ad16bd330cfa1d326eecdcae8a10db03fb.tar.bz2
Fixes a NullPointerException in smiley replacement.
Diffstat (limited to 'src/net/java/sip/communicator/impl/replacement')
-rw-r--r--src/net/java/sip/communicator/impl/replacement/smiley/ReplacementServiceSmileyImpl.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/net/java/sip/communicator/impl/replacement/smiley/ReplacementServiceSmileyImpl.java b/src/net/java/sip/communicator/impl/replacement/smiley/ReplacementServiceSmileyImpl.java
index a238fc0..8e657ff 100644
--- a/src/net/java/sip/communicator/impl/replacement/smiley/ReplacementServiceSmileyImpl.java
+++ b/src/net/java/sip/communicator/impl/replacement/smiley/ReplacementServiceSmileyImpl.java
@@ -23,11 +23,17 @@ public class ReplacementServiceSmileyImpl
implements SmiliesReplacementService
{
/**
+ * The <tt>Logger</tt> used by the <tt>ReplacementServiceSmileyImpl</tt>
+ * class and its instances for logging output.
+ */
+ private static final Logger logger
+ = Logger.getLogger(ReplacementServiceSmileyImpl.class);
+
+ /**
* The <tt>List</tt> of smiley strings which are matched by
* {@link #smileyRegex}.
*/
- private static final java.util.List<String> smileyStrings =
- new ArrayList<String>();
+ private static final List<String> smileyStrings = new ArrayList<String>();
/**
* Configuration label shown in the config form.
@@ -50,13 +56,17 @@ public class ReplacementServiceSmileyImpl
{
try
{
- return Resources.getSmiley(sourceString.trim()).getImagePath();
+ Smiley smiley = Resources.getSmiley(sourceString.trim());
+
+ if (smiley != null)
+ return smiley.getImagePath();
}
catch (Exception e)
{
- e.printStackTrace();
+ logger.error(
+ "Failed to get smiley replacement for " + sourceString,
+ e);
}
-
return sourceString;
}
@@ -164,4 +174,4 @@ public class ReplacementServiceSmileyImpl
{
Resources.reloadResources();
}
-} \ No newline at end of file
+}