TunnelListFragment: catch all parsing exceptions

Otherwise we crash if weird things happen.

Reported-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-19 13:01:51 -06:00
parent 240e049e46
commit 87c9efce4a

View File

@ -62,10 +62,7 @@ class TunnelListFragment : BaseFragment() {
// Config text is valid, now create the tunnel… // Config text is valid, now create the tunnel…
newInstance(configText).show(parentFragmentManager, null) newInstance(configText).show(parentFragmentManager, null)
} catch (e: Exception) { } catch (e: Exception) {
when(e) { onTunnelImportFinished(emptyList(), listOf<Throwable>(e))
is BadConfigException, is IOException -> onTunnelImportFinished(emptyList(), listOf<Throwable>(e))
else -> throw e
}
} }
} }