Handle NULL returns from unicode_character_data() (e.g. ENOMEM)
diff --git a/nametoucs.c b/nametoucs.c
index 4a9a414..8185b1a 100644
--- a/nametoucs.c
+++ b/nametoucs.c
@@ -45,6 +45,9 @@
   const struct unicode_character_data *ucd =
     unicode_character_data(ucs);
 
+  if ( !ucd )
+    return NULL;
+
   if ( !ucd->name || strcmp(name, ucd->name) ) {
     unicode_character_put(ucd);
     errno = EINVAL;