Check for config->options == NULL
This commit is contained in:
parent
f19732d364
commit
7cdbcaf25e
|
@ -58,21 +58,33 @@ create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEn
|
||||||
has_payload = false;
|
has_payload = false;
|
||||||
const config_setting_t *setting;
|
const config_setting_t *setting;
|
||||||
|
|
||||||
if ((setting = config_setting_get_member(config->options, "namespace"))) {
|
if (config->options) {
|
||||||
has_ns = true;
|
if ((setting = config_setting_get_member(config->options, "namespace"))) {
|
||||||
source.code.ns = env_resolve_constant(env, setting);
|
has_ns = true;
|
||||||
}
|
source.code.ns = env_resolve_constant(env, setting);
|
||||||
if ((setting = config_setting_get_member(config->options, "major"))) {
|
}
|
||||||
has_maj = true;
|
if ((setting = config_setting_get_member(config->options, "major"))) {
|
||||||
source.code.major = env_resolve_constant(env, setting);
|
has_maj = true;
|
||||||
}
|
source.code.major = env_resolve_constant(env, setting);
|
||||||
if ((setting = config_setting_get_member(config->options, "minor"))) {
|
}
|
||||||
has_min = true;
|
if ((setting = config_setting_get_member(config->options, "minor"))) {
|
||||||
source.code.minor = env_resolve_constant(env, setting);
|
has_min = true;
|
||||||
}
|
source.code.minor = env_resolve_constant(env, setting);
|
||||||
if ((setting = config_setting_get_member(config->options, "payload"))) {
|
}
|
||||||
has_payload = true;
|
if ((setting = config_setting_get_member(config->options, "payload"))) {
|
||||||
source.payload = env_resolve_constant(env, setting);
|
has_payload = true;
|
||||||
|
source.payload = env_resolve_constant(env, setting);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Prevent warning for uninitialized variable
|
||||||
|
source = (EventData) {
|
||||||
|
.code = {
|
||||||
|
.ns = 0,
|
||||||
|
.major = 0,
|
||||||
|
.minor = 0,
|
||||||
|
},
|
||||||
|
.payload = 0,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
*node = (AssignGraphNode) {
|
*node = (AssignGraphNode) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEn
|
||||||
|
|
||||||
int64_t initial = 0;
|
int64_t initial = 0;
|
||||||
if (config->options) {
|
if (config->options) {
|
||||||
// FIXME check config->options for NULL in all node types
|
|
||||||
initial = env_resolve_constant(env, config_setting_get_member(config->options, "initial"));
|
initial = env_resolve_constant(env, config_setting_get_member(config->options, "initial"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEn
|
||||||
}
|
}
|
||||||
const char *filename = NULL;
|
const char *filename = NULL;
|
||||||
bool should_grab = false;
|
bool should_grab = false;
|
||||||
if (config) {
|
if (config->options) {
|
||||||
node->namespace = env_resolve_constant(env, config_setting_get_member(config->options, "namespace"));
|
node->namespace = env_resolve_constant(env, config_setting_get_member(config->options, "namespace"));
|
||||||
should_grab = env_resolve_constant(env, config_setting_get_member(config->options, "grab")) != 0;
|
should_grab = env_resolve_constant(env, config_setting_get_member(config->options, "grab")) != 0;
|
||||||
config_setting_lookup_string(config->options, "file", &filename);
|
config_setting_lookup_string(config->options, "file", &filename);
|
||||||
|
|
|
@ -70,7 +70,7 @@ create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEn
|
||||||
.handle_io = handle_io,
|
.handle_io = handle_io,
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
},
|
},
|
||||||
.namespace = env_resolve_constant(env, config_setting_get_member(config->options, "namespace")),
|
.namespace = config->options ? env_resolve_constant(env, config_setting_get_member(config->options, "namespace")) : 0,
|
||||||
};
|
};
|
||||||
return &node->as_GraphNode;
|
return &node->as_GraphNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,10 @@ handle_event(EventPositionBase * self, EventNode * event)
|
||||||
static GraphNode *
|
static GraphNode *
|
||||||
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
||||||
{
|
{
|
||||||
(void) config;
|
if (!config->options) {
|
||||||
(void) env;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ModifiersGraphNode * node = T_ALLOC(1, ModifiersGraphNode);
|
ModifiersGraphNode * node = T_ALLOC(1, ModifiersGraphNode);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -50,8 +50,10 @@ handle_event(EventPositionBase * self, EventNode * event)
|
||||||
static GraphNode *
|
static GraphNode *
|
||||||
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
||||||
{
|
{
|
||||||
(void) config;
|
if (!config->options) {
|
||||||
(void) env;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ModifyPredicateGraphNode * node = T_ALLOC(1, ModifyPredicateGraphNode);
|
ModifyPredicateGraphNode * node = T_ALLOC(1, ModifyPredicateGraphNode);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -28,8 +28,10 @@ handle_event(EventPositionBase * self, EventNode * event)
|
||||||
static GraphNode *
|
static GraphNode *
|
||||||
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
||||||
{
|
{
|
||||||
(void) config;
|
if (!config->options) {
|
||||||
(void) env;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
RouterGraphNode * node = T_ALLOC(1, RouterGraphNode);
|
RouterGraphNode * node = T_ALLOC(1, RouterGraphNode);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -78,6 +78,10 @@ handle_event(EventPositionBase * self, EventNode * event)
|
||||||
static GraphNode *
|
static GraphNode *
|
||||||
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
create(GraphNodeSpecification * spec, GraphNodeConfig * config, InitializationEnvironment * env)
|
||||||
{
|
{
|
||||||
|
if (!config->options) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
UinputGraphNode * node = T_ALLOC(1, UinputGraphNode);
|
UinputGraphNode * node = T_ALLOC(1, UinputGraphNode);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue