Permalink
Browse files

Don't require CTimer's label to be unique if its empty (Fixes #92)

  • Loading branch information...
1 parent 721d603 commit 8a44c872725f468a593aa892dab5282ead38798d @kylef kylef committed Nov 24, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/Modules.cpp
View
@@ -233,7 +233,7 @@ bool CModule::ClearNV(bool bWriteToDisk) {
}
bool CModule::AddTimer(CTimer* pTimer) {
- if ((!pTimer) || (FindTimer(pTimer->GetName()))) {
+ if ((!pTimer) || (!pTimer->GetName().empty() && FindTimer(pTimer->GetName()))) {
delete pTimer;
return false;
}
@@ -280,6 +280,10 @@ bool CModule::UnlinkTimer(CTimer* pTimer) {
}
CTimer* CModule::FindTimer(const CString& sLabel) {
+ if (sLabel.empty()) {
+ return NULL;
+ }
+
set<CTimer*>::iterator it;
for (it = m_sTimers.begin(); it != m_sTimers.end(); ++it) {
CTimer* pTimer = *it;

0 comments on commit 8a44c87

Please sign in to comment.