mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 697063 - Tabs.getSelectedTab returns null until Gecko starts and will cause crashes [r=mfinkle]
This commit is contained in:
parent
4c96c8f3b4
commit
030bef94b4
@ -449,6 +449,11 @@ abstract public class GeckoApp
|
||||
case R.id.bookmarks:
|
||||
Intent intent = new Intent(this, GeckoBookmarks.class);
|
||||
tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab == null) {
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
he = tab.getLastHistoryEntry();
|
||||
if (he != null) {
|
||||
intent.setData(android.net.Uri.parse(he.mUri));
|
||||
@ -458,6 +463,9 @@ abstract public class GeckoApp
|
||||
return true;
|
||||
case R.id.share:
|
||||
tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab == null)
|
||||
return true;
|
||||
|
||||
he = tab.getLastHistoryEntry();
|
||||
if (he != null) {
|
||||
GeckoAppShell.openUriExternal(he.mUri, "text/plain", "", "",
|
||||
@ -479,6 +487,9 @@ abstract public class GeckoApp
|
||||
if (surfaceView == null)
|
||||
return;
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab == null)
|
||||
return;
|
||||
|
||||
if (!tab.getHistory().empty()) {
|
||||
SharedPreferences prefs = getSharedPreferences("GeckoApp", 0);
|
||||
Editor editor = prefs.edit();
|
||||
@ -1441,7 +1452,7 @@ abstract public class GeckoApp
|
||||
if (aType != AwesomeBar.Type.ADD) {
|
||||
// if we're not adding a new tab, show the old url
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (!tab.getHistory().empty()) {
|
||||
if (tab != null && !tab.getHistory().empty()) {
|
||||
intent.putExtra(AwesomeBar.CURRENT_URL_KEY, tab.getHistory().peek().mUri);
|
||||
}
|
||||
}
|
||||
@ -1452,6 +1463,9 @@ abstract public class GeckoApp
|
||||
public boolean doReload() {
|
||||
Log.i(LOG_FILE_NAME, "Reload requested");
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab == null)
|
||||
return false;
|
||||
|
||||
return tab.doReload();
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,9 @@ public class GeckoBookmarks extends ListActivity {
|
||||
}
|
||||
|
||||
public void addBookmark(View v) {
|
||||
Browser.saveBookmark(this, mTitle, mUri.toString());
|
||||
if (mUri != null)
|
||||
Browser.saveBookmark(this, mTitle, mUri.toString());
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user