From ccd4b2953bb039e91b301a616c5f7c6f542b6b10 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 20 Jun 2015 15:21:26 +0545 Subject: [PATCH] sim: common: add basic model assert If the configured in default doesn't match a known value, throw an assertion failure rather than segfaulting deeper down. --- sim/common/ChangeLog | 4 ++++ sim/common/sim-model.c | 1 + 2 files changed, 5 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 30a121cd963..722ad988436 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2015-06-21 Mike Frysinger + + * sim-model.c (sim_model_init): Assert model is not NULL. + 2015-06-21 Mike Frysinger * sim-types.h: Move SIM_TYPES_H define to top of file. Include diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c index a33bd2a7db2..db5f323a7cc 100644 --- a/sim/common/sim-model.c +++ b/sim/common/sim-model.c @@ -204,6 +204,7 @@ sim_model_init (SIM_DESC sd) { /* Set the default model. */ const MODEL *model = sim_model_lookup (WITH_DEFAULT_MODEL); + SIM_ASSERT (model != NULL); sim_model_set (sd, NULL, model); } -- 2.30.2