summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-09-10 19:55:14 +0200
committerDave Davenport <qball@gmpclient.org>2017-09-10 19:55:14 +0200
commita442dda19ce7fec8763f29e3424b5e32c3d112cc (patch)
tree0bdf056345b503ec8a05ae705cdd831c5006e358
parentec252049243c0b53b583a041ffb1bf006066cce7 (diff)
Fix combi modi crashing on dynamic list sizes.
-rw-r--r--source/dialogs/combi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c
index 5631c519..a41e54e6 100644
--- a/source/dialogs/combi.c
+++ b/source/dialogs/combi.c
@@ -125,7 +125,14 @@ static int combi_mode_init ( Mode *sw )
static unsigned int combi_mode_get_num_entries ( const Mode *sw )
{
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
- return pd->cmd_list_length;
+ unsigned int length = 0;
+ for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
+ unsigned int entries = mode_get_num_entries ( pd->switchers[i].mode );
+ pd->starts[i] = length;
+ pd->lengths[i] = entries;
+ length+=entries;
+ }
+ return length;
}
static void combi_mode_destroy ( Mode *sw )
{