Fix potential segfault in ICUs error handling

Fixes #3118