mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-08 15:12:40 +01:00
DroidFish: Fixed potential null pointer dereferences.
This commit is contained in:
@@ -275,7 +275,7 @@ public class EditPGN extends ListActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int pos, long id) {
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
selectedGi = aa.getItem(pos);
|
selectedGi = aa.getItem(pos);
|
||||||
if (!selectedGi.isNull()) {
|
if (selectedGi != null && !selectedGi.isNull()) {
|
||||||
removeDialog(DELETE_GAME_DIALOG);
|
removeDialog(DELETE_GAME_DIALOG);
|
||||||
showDialog(DELETE_GAME_DIALOG);
|
showDialog(DELETE_GAME_DIALOG);
|
||||||
}
|
}
|
||||||
@@ -334,6 +334,8 @@ public class EditPGN extends ListActivity {
|
|||||||
case DELETE_GAME_DIALOG: {
|
case DELETE_GAME_DIALOG: {
|
||||||
final GameInfo gi = selectedGi;
|
final GameInfo gi = selectedGi;
|
||||||
selectedGi = null;
|
selectedGi = null;
|
||||||
|
if (gi == null)
|
||||||
|
return null;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.delete_game);
|
builder.setTitle(R.string.delete_game);
|
||||||
String msg = gi.toString();
|
String msg = gi.toString();
|
||||||
@@ -355,6 +357,8 @@ public class EditPGN extends ListActivity {
|
|||||||
case SAVE_GAME_DIALOG: {
|
case SAVE_GAME_DIALOG: {
|
||||||
final GameInfo gi = selectedGi;
|
final GameInfo gi = selectedGi;
|
||||||
selectedGi = null;
|
selectedGi = null;
|
||||||
|
if (gi == null)
|
||||||
|
return null;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.save_game_question);
|
builder.setTitle(R.string.save_game_question);
|
||||||
final CharSequence[] items = {
|
final CharSequence[] items = {
|
||||||
|
|||||||
Reference in New Issue
Block a user