Skip to content

Commit

Permalink
Don't require CTimer's label to be unique if its empty (Fixes #92)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef committed Jul 27, 2012
1 parent 721d603 commit 8a44c87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Modules.cpp
Expand Up @@ -233,7 +233,7 @@ bool CModule::ClearNV(bool bWriteToDisk) {
} }


bool CModule::AddTimer(CTimer* pTimer) { bool CModule::AddTimer(CTimer* pTimer) {
if ((!pTimer) || (FindTimer(pTimer->GetName()))) { if ((!pTimer) || (!pTimer->GetName().empty() && FindTimer(pTimer->GetName()))) {
delete pTimer; delete pTimer;
return false; return false;
} }
Expand Down Expand Up @@ -280,6 +280,10 @@ bool CModule::UnlinkTimer(CTimer* pTimer) {
} }


CTimer* CModule::FindTimer(const CString& sLabel) { CTimer* CModule::FindTimer(const CString& sLabel) {
if (sLabel.empty()) {
return NULL;
}

set<CTimer*>::iterator it; set<CTimer*>::iterator it;
for (it = m_sTimers.begin(); it != m_sTimers.end(); ++it) { for (it = m_sTimers.begin(); it != m_sTimers.end(); ++it) {
CTimer* pTimer = *it; CTimer* pTimer = *it;
Expand Down

0 comments on commit 8a44c87

Please sign in to comment.