summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorroot <voodik.am@gmail.com>2015-05-31 13:52:43 +0400
committerEthan Chen <intervigil@gmail.com>2015-06-01 12:45:09 -0700
commit97739e1502858c9e04a9479c4a6a28252bc9cd52 (patch)
tree26aff100112064ee0b7631f77a160787a175e1bf /src
parenta33834eae3f5b6b84331bc6c97a414c7471902c9 (diff)
downloadandroid_packages_apps_Gallery2-97739e1502858c9e04a9479c4a6a28252bc9cd52.zip
android_packages_apps_Gallery2-97739e1502858c9e04a9479c4a6a28252bc9cd52.tar.gz
android_packages_apps_Gallery2-97739e1502858c9e04a9479c4a6a28252bc9cd52.tar.bz2
Gallery2: Fix crash when Bluetooth service is disabled
Change-Id: I2807b0e2be58a0661bb2161d5d894c0191d050b2
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/MovieActivity.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java
index 63fb65b..275b04a 100644
--- a/src/com/android/gallery3d/app/MovieActivity.java
+++ b/src/com/android/gallery3d/app/MovieActivity.java
@@ -595,8 +595,9 @@ public class MovieActivity extends Activity {
private boolean isBtHeadsetConnected() {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if ((BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET))
- || (BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.A2DP))) {
+ if (adapter != null && adapter.isEnabled() &&
+ (BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET)
+ || BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.A2DP))) {
return true;
}
return false;