summaryrefslogtreecommitdiff
path: root/gdb/reggroups.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/reggroups.c')
-rw-r--r--gdb/reggroups.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 791ec0abd52..70009577818 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -132,13 +132,18 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
if (groups->first == NULL)
groups = &default_groups;
- /* Retun the first/next reggroup. */
+ /* Return the first/next reggroup. */
if (last == NULL)
return groups->first->group;
for (el = groups->first; el != NULL; el = el->next)
{
if (el->group == last)
- return el->next->group;
+ {
+ if (el->next != NULL)
+ return el->next->group;
+ else
+ return NULL;
+ }
}
return NULL;
}