forked from organicmaps/organicmaps
Fix issue when mwm file is an invalid map (file is broken), we should delete it by request too.
This commit is contained in:
parent
0e6fe9465b
commit
8633009162
2 changed files with 12 additions and 2 deletions
|
@ -90,12 +90,19 @@ MwmSet::MwmId MwmSet::GetFreeId()
|
|||
|
||||
MwmSet::MwmId MwmSet::GetIdByName(string const & name)
|
||||
{
|
||||
ASSERT ( !name.empty(), () );
|
||||
|
||||
for (MwmId i = 0; i < m_info.size(); ++i)
|
||||
{
|
||||
UpdateMwmInfo(i);
|
||||
|
||||
if (m_name[i] == name)
|
||||
{
|
||||
ASSERT_NOT_EQUAL ( m_info[i].m_status, MwmInfo::STATUS_REMOVED, () );
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_MWM_ID;
|
||||
}
|
||||
|
||||
|
@ -167,10 +174,10 @@ void MwmSet::Remove(string const & fileName)
|
|||
|
||||
bool MwmSet::RemoveImpl(string const & fileName)
|
||||
{
|
||||
bool ret = false;
|
||||
bool ret = true;
|
||||
|
||||
MwmId const id = GetIdByName(fileName);
|
||||
if (id != INVALID_MWM_ID && m_info[id].IsExist())
|
||||
if (id != INVALID_MWM_ID)
|
||||
{
|
||||
ret = RemoveImpl(id);
|
||||
|
||||
|
|
|
@ -91,8 +91,11 @@ public:
|
|||
/// @name Remove mwm.
|
||||
//@{
|
||||
protected:
|
||||
/// @return true - map is free; false - map is busy
|
||||
//@{
|
||||
bool RemoveImpl(MwmId id);
|
||||
bool RemoveImpl(string const & fileName);
|
||||
//@}
|
||||
|
||||
public:
|
||||
void Remove(string const & fileName);
|
||||
|
|
Loading…
Add table
Reference in a new issue