Skip to content

Commit

Permalink
issue#55 Handling NPE
Browse files Browse the repository at this point in the history
It handles null log message.
When null is given as a parameter, log() function tries to get bytes
of it, thus NPE exception occurs

Checkstyle match

Matching checkstyle properly
  • Loading branch information
hrskrs committed Feb 17, 2016
1 parent b41c071 commit 9002b74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ private synchronized void log(int logType, String msg, Object... args) {
String message = createMessage(msg, args);
int methodCount = getMethodCount();

if (TextUtils.isEmpty(message)) {
message = "Empty/NULL log message";
}

logTopBorder(logType, tag);
logHeaderContent(logType, tag, methodCount);

Expand Down

0 comments on commit 9002b74

Please sign in to comment.