(concord_object_get_feature_value): If `concord_current_env' is not
authorMORIOKA Tomohiko <tomo.git@chise.org>
Sun, 21 Apr 2013 07:43:44 +0000 (16:43 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Sun, 21 Apr 2013 07:43:44 +0000 (16:43 +0900)
a valid CONCORD_DS object, set NULL.

cos.c

diff --git a/cos.c b/cos.c
index 878b8c9..42b66dd 100644 (file)
--- a/cos.c
+++ b/cos.c
@@ -552,6 +552,7 @@ COS_object
 concord_object_get_feature_value (COS_object object, COS_object feature)
 {
   char id_buf[256];
+  CONCORD_Genre gobj;
   CONCORD_Feature fobj;
   CONCORD_String_Tank val_st;
   size_t end;
@@ -563,8 +564,17 @@ concord_object_get_feature_value (COS_object object, COS_object feature)
   else
     return NULL;
 
-  fobj = concord_get_feature (concord_current_env,
-                             "character", feature);
+  if (!COS_OBJECT_DS_P (concord_current_env))
+    {
+      concord_current_env = NULL;
+      return NULL;
+    }
+
+  gobj = concord_get_genre (concord_current_env, "character");
+  if (gobj == NULL)
+    return NULL;
+
+  fobj = concord_get_feature (concord_current_env, gobj, feature);
   if (fobj == NULL)
     return NULL;