Alex Klimashevsky
Alex Klimashevsky

Reputation: 2495

NullPointerException inside catch part

I have a code like:

try{
    //todo somethins
} catch(Exception e){
    Log.e("tag", e.getMessage());
}

And I catched NullPointerException on row Log.e("tag", e.getMessage()); at google analytic page How is it possible?

Upvotes: 0

Views: 92

Answers (1)

Ronald Meijboom
Ronald Meijboom

Reputation: 1564

Your e.getMessage() is probably null. The exception that you are catching doesn't have a message.

Also don't try to catch raw exceptions. You could use NullPointerException.

See this link: Exception.getMessage() is null

Upvotes: 1

Related Questions