Skip to content

Commit

Permalink
#1506 Enhances null checking and logging in Broadcaster class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Sheirer committed Mar 25, 2023
1 parent bc79af0 commit 93c0d9c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/io/github/dsheirer/sample/Broadcaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,23 @@ public void broadcast(T t)
{
for(Listener<T> listener: mListeners)
{
listener.receive(t);
if(listener != null)
{
try
{
listener.receive(t);
}
catch(Exception e)
{
mLog.error("Error while broadcasting [" + t.getClass() + "] to listener [" +
listener.getClass() + "] - " + e.getMessage());
}
}
}
}
catch(Exception e)
{
mLog.error("Error while broadcasting [" + t.getClass() + "] to listeners");
mLog.error("Error while broadcasting [" + t.getClass() + "] to listeners - " + e.getMessage());
}
}
}

0 comments on commit 93c0d9c

Please sign in to comment.