Fix segfault reported in #1447