Commit a74e85ba authored by Edward Wang's avatar Edward Wang

src: Check for null in ALL WeakHandlers, fix a bunch of crashes

parent fcb5a4d5
......@@ -269,6 +269,8 @@ public class AudioService extends Service {
@Override
public void handleMessage(Message msg) {
AudioService service = getOwner();
if(service == null) return;
switch (msg.getData().getInt("event")) {
case EventManager.MediaPlayerPlaying:
Log.i(TAG, "MediaPlayerPlaying");
......@@ -340,6 +342,8 @@ public class AudioService extends Service {
@Override
public void handleMessage(Message msg) {
AudioService service = getOwner();
if(service == null) return;
switch (msg.what) {
case SHOW_PROGRESS:
if (service.mCallback.size() > 0) {
......
......@@ -372,6 +372,8 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
@Override
public void handleMessage(Message msg) {
AudioBrowserFragment fragment = getOwner();
if(fragment == null) return;
switch (msg.what) {
case MediaLibrary.MEDIA_ITEMS_UPDATED:
fragment.updateLists();
......
......@@ -209,6 +209,8 @@ public class AudioListFragment extends SherlockListFragment {
@Override
public void handleMessage(Message msg) {
AudioListFragment fragment = getOwner();
if(fragment == null) return;
switch (msg.what) {
case MediaLibrary.MEDIA_ITEMS_UPDATED:
fragment.updateList();
......
......@@ -478,6 +478,8 @@ public class VideoPlayerActivity extends Activity {
@Override
public void handleMessage(Message msg) {
VideoPlayerActivity activity = getOwner();
if(activity == null) return;
switch (msg.getData().getInt("event")) {
case EventManager.MediaPlayerPlaying:
Log.i(TAG, "MediaPlayerPlaying");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment