scd: Do not try to use a non-enabled app after card switching.
* scd/app.c (app_dump_state): Also print the refcount. (maybe_switch_app): Make sure the app exists on the card.
When switching the current card and the card does not support the same
apps as the former, we now reset the app to the first one.
Testcase is to use a standard OpenPGP card and a P15 card.
- Signed-off-by: Werner Koch <wk@gnupg.org>