Modified Log.d that could cause NullPointerException