mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
don't crash when first run without network connection
This commit is contained in:
parent
013e0e3a4c
commit
3064420c78
2 changed files with 43 additions and 38 deletions
|
@ -1140,6 +1140,7 @@ public class DictsDelegate extends ListDelegateBase
|
|||
JSONObject theOne = null;
|
||||
String langName = null;
|
||||
String json = NetUtils.runPost( post, new JSONObject() );
|
||||
if ( null != json ) {
|
||||
try {
|
||||
JSONObject obj = new JSONObject( json );
|
||||
JSONArray langs = obj.optJSONArray( "langs" );
|
||||
|
@ -1163,7 +1164,8 @@ public class DictsDelegate extends ListDelegateBase
|
|||
break;
|
||||
} else {
|
||||
int nWords = dict.getInt( "nWords" );
|
||||
if ( null == theOne || nWords > theOneNWords ) {
|
||||
if ( null == theOne
|
||||
|| nWords > theOneNWords ) {
|
||||
theOne = dict;
|
||||
theOneNWords = nWords;
|
||||
}
|
||||
|
@ -1185,6 +1187,7 @@ public class DictsDelegate extends ListDelegateBase
|
|||
DbgUtils.loge( ex );
|
||||
theOne = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( null != theOne ) {
|
||||
name = theOne.optString( "xwd" );
|
||||
|
|
|
@ -234,6 +234,8 @@ public class NetUtils {
|
|||
}
|
||||
} catch( java.io.UnsupportedEncodingException uee ) {
|
||||
DbgUtils.loge( uee );
|
||||
} catch( java.net.UnknownHostException uhe ) {
|
||||
DbgUtils.loge( uhe );
|
||||
} catch( java.io.IOException ioe ) {
|
||||
DbgUtils.loge( ioe );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue