Commit 09cee4a5 authored by kelvinp@chromium.org's avatar kelvinp@chromium.org

Fix Chromoting Android client crashed on launch

We crash because mRefreshButton is null when updateUI() is called.
mRefreshButton is initialized on onCreateOptionsMenu()

According to http://stackoverflow.com/questions/13267030/oncreateoptionsmenu-is-never-called, seems like 
onCreateOptionMenu will never got called on some themes on phones with menu button.

I can repro by overriding the theme to @android:style/Theme.Black.NoTitleBar

The fix is adding a null check.

BUG=364591

Review URL: https://codereview.chromium.org/308793007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274354 0039d316-1c4b-4281-b951-d872f2087c98
parent 0f939daf
...@@ -19,7 +19,6 @@ import android.content.DialogInterface; ...@@ -19,7 +19,6 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
...@@ -397,8 +396,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe ...@@ -397,8 +396,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
* Updates the infotext and host list display. * Updates the infotext and host list display.
*/ */
private void updateUi() { private void updateUi() {
mRefreshButton.setEnabled(mAccount != null); if (mRefreshButton != null) {
mRefreshButton.setEnabled(mAccount != null);
}
ArrayAdapter<HostInfo> displayer = new HostListAdapter(this, R.layout.host, mHosts); ArrayAdapter<HostInfo> displayer = new HostListAdapter(this, R.layout.host, mHosts);
Log.i("hostlist", "About to populate host list display"); Log.i("hostlist", "About to populate host list display");
mHostListView.setAdapter(displayer); mHostListView.setAdapter(displayer);
......
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