Hopefully fixed crash in RemotePlayService#sendMessage, minor refactoring.
This commit is contained in:
parent
17fe44e203
commit
80d897ba36
1 changed files with 7 additions and 3 deletions
|
@ -74,9 +74,9 @@ public class RemotePlayService extends Service implements RegistryListener {
|
||||||
|
|
||||||
private static final String TAG = "RemotePlayService";
|
private static final String TAG = "RemotePlayService";
|
||||||
|
|
||||||
Messenger mListener;
|
protected Messenger mListener;
|
||||||
|
|
||||||
ConcurrentHashMap<String, Device<?, ?, ?>> mDevices =
|
protected ConcurrentHashMap<String, Device<?, ?, ?>> mDevices =
|
||||||
new ConcurrentHashMap<String, Device<?, ?, ?>>();
|
new ConcurrentHashMap<String, Device<?, ?, ?>>();
|
||||||
|
|
||||||
protected AndroidUpnpService mUpnpService;
|
protected AndroidUpnpService mUpnpService;
|
||||||
|
@ -144,11 +144,15 @@ public class RemotePlayService extends Service implements RegistryListener {
|
||||||
* Sends msg via Messenger to Provider.
|
* Sends msg via Messenger to Provider.
|
||||||
*/
|
*/
|
||||||
void sendMessage(Message msg) {
|
void sendMessage(Message msg) {
|
||||||
|
if (mListener == null) {
|
||||||
|
Log.w(TAG, "Listener is not initialized on send");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mListener.send(msg);
|
mListener.send(msg);
|
||||||
}
|
}
|
||||||
catch (RemoteException e) {
|
catch (RemoteException e) {
|
||||||
e.printStackTrace();
|
Log.w(TAG, "Failed to send message", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue