diff --git a/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp b/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp index f1302a2cb7..268dca92b6 100644 --- a/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp +++ b/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp @@ -1,9 +1,10 @@ /* - * Copyright 1999-2009 Haiku Inc. All rights reserved. + * Copyright 1999-2014 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Jeremy Friesner + * John Scipione, jscipione@gmail.com */ @@ -323,16 +324,17 @@ KeyCommandMap::MessageReceived(BMessage* msg) } -//! Deletes an HKS-filled BList and its contents. +// deletes the BList and its contents void -KeyCommandMap::_DeleteHKSList(BList* l) +KeyCommandMap::_DeleteHKSList(BList* list) { - if (l != NULL) { - int num = l->CountItems(); - for (int i = 0; i < num; i++) - delete ((hks*) l->ItemAt(i)); - delete l; - } + if (list == NULL) + return; + + while (list->ItemAt(0) != NULL) + delete list->ItemAt(0); + + delete list; }