context BUGFIX check input parameters in public functions
diff --git a/src/context.c b/src/context.c
index d790c87..97fff0b 100644
--- a/src/context.c
+++ b/src/context.c
@@ -298,14 +298,16 @@
}
API int
-ly_ctx_get_options(struct ly_ctx *ctx)
+ly_ctx_get_options(const struct ly_ctx *ctx)
{
+ LY_CHECK_ARG_RET(ctx, ctx, 0);
return ctx->flags;
}
API uint16_t
ly_ctx_get_module_set_id(const struct ly_ctx *ctx)
{
+ LY_CHECK_ARG_RET(ctx, ctx, 0);
return ctx->module_set_id;
}
diff --git a/src/libyang.h b/src/libyang.h
index 9b850e1..17ac51f 100644
--- a/src/libyang.h
+++ b/src/libyang.h
@@ -135,7 +135,7 @@
* @param[in] ctx Context to query.
* @return Combination of all the currently set context's options, see @ref contextoptions.
*/
-int ly_ctx_get_options(struct ly_ctx *ctx);
+int ly_ctx_get_options(const struct ly_ctx *ctx);
/**
* @brief Make context to stop searching for schemas (imported, included or requested via ly_ctx_load_module())