Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin suggest: add missing NULL check for grn_ctx_at() #768

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kenhys
Copy link
Member

@kenhys kenhys commented Oct 10, 2017

No description provided.

@@ -657,10 +657,22 @@ learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner)
grn_obj *seqs, *events, *post_item, *items, *pairs;

learner->seqs = seqs = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAIN(learner->seq));
if (!learner->seqs) {
ERR(GRN_DOMAIN_ERROR,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why GRN_DOMAIN_ERROR?

It's based on EDOM:

   EDOM            Mathematics argument out of domain of function
                  (POSIX.1, C99).

http://man7.org/linux/man-pages/man3/errno.3.html

learner->seqs_events = grn_obj_column(ctx, seqs, CONST_STR_LEN("events"));

events_id = grn_obj_get_range(ctx, learner->seqs_events);
learner->events = events = grn_ctx_at(ctx, events_id);
if (!learner->events) {
ERR(GRN_UNKNOWN_ERROR,
"failed to initialize columns because event id: <%d> is not found.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last "." is needless.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: <...> should be placed at the last. We should not put it the middle of sentence.

"failed to refer sequence's event table: <%.*s>: <%u>(<%.*s>)", seqs_events_name_size, seqs_events_name, events_id, events_name_size, events_name)"

events_name will be able to get by grn_table_get_key() against grn_ctx_db().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants