In my app I get a Force Close, and I don't know how to solve this. The problem is that I have a class that extends ListActivity. In this class there is a list of shops, and the user should select one of the shops. If he not select a shop and press button Back I get Force Close, because the previous class expect the name of the shop. How can I catch this error?

Here is my class for selecting a shop :

```
public class SelectShop extends ListActivity {

private ListView lv1;
SimpleCursorAdapter adapter = null;
Cursor cursor;
DbAdapter db;
ImageView iconshop;

private static final int ADD=Menu.FIRST;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.shopselect);

    iconshop = (ImageView) findViewById(R.id.iconshop);
    lv1 = getListView();

    DbApplication myApplication = (DbApplication) this.getApplication();
    db= myApplication.getDatabaseAdapter();

    cursor = db.getAllShops();
    startManagingCursor(cursor);
    if (cursor != null && cursor.moveToFirst()){
    adapter = new SimpleCursorAdapter(this, R.layout.shopsrow, cursor,
            new String[] { DbAdapter.NAME, DbAdapter.ADRESS }, new int[] {
                    R.id.title, R.id.address });

    setListAdapter(adapter);
    }else Toast.makeText(this,
            "Choose Menu for adding a shop",
            Toast.LENGTH_LONG).show();

    lv1.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v,
                int position, long id) {
            Intent j = new Intent(SelectShop.this,
                    com.ShoppingList.NewList.class);

            Cursor c = (Cursor) parent.getAdapter().getItem(position);
            j.putExtra("shop", c.getString(c.getColumnIndex(db.NAME)));
            setResult(RESULT_OK, j);
            finish();
        }
    });
}
/*Adaugarea meniului Add Shop*/
public boolean onCreateOptionsMenu(Menu menu) { 
    menu.add(0, ADD, 0, "Add Shop").setIcon(R.drawable.additem); 
    return true; 
    }

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case ADD:
        Intent j = new Intent(SelectShop.this, Shops.class);
        startActivityForResult(j, 0);
        return true;
    }
    return false;
}

```

}

and in previuos class I have this:

```
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        switch (requestCode) {
        case 0: {
            Bundle b = intent.getExtras();
            shopselect = b.getString("shop");
            shop.setText(shopselect);
        }
            break;
}
}

```