Bug 762068 - Part 3: Replace optString() with null checks. r=mfinkle

--HG--
extra : rebase_source : 315799b482e1db65ea1080216a765066966662dc
This commit is contained in:
Brian Nicholson 2012-06-12 10:03:14 -07:00
parent ab1619d670
commit 196773f134

View File

@ -234,8 +234,8 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
public void handleMessage(String event, JSONObject message) {
try {
if (event.equals("SearchEngines:Data")) {
final String suggestEngine = message.optString("suggestEngine");
final String suggestTemplate = message.optString("suggestTemplate");
final String suggestEngine = message.isNull("suggestEngine") ? null : message.getString("suggestEngine");
final String suggestTemplate = message.isNull("suggestTemplate") ? null : message.getString("suggestTemplate");
if (suggestTemplate != null)
mSuggestClient = new SuggestClient(GeckoApp.mAppContext, suggestTemplate, SUGGESTION_TIMEOUT, SUGGESTION_MAX);
mAwesomeTabs.setSearchEngines(suggestEngine, message.getJSONArray("searchEngines"));