Skip to content

Commit

Permalink
ensure we check ptrs in several MusicDatabase routines. part of xbmc#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Dec 18, 2012
1 parent f7d761e commit 78ad73c
Showing 1 changed file with 12 additions and 35 deletions.
47 changes: 12 additions & 35 deletions xbmc/music/MusicDatabase.cpp
Expand Up @@ -1234,6 +1234,9 @@ bool CMusicDatabase::GetAlbumInfo(int idAlbum, CAlbum &info, VECSONGS* songs, bo
{ {
try try
{ {
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS2.get()) return false;

if (idAlbum == -1) if (idAlbum == -1)
return false; // not in the database return false; // not in the database


Expand Down Expand Up @@ -1289,30 +1292,18 @@ bool CMusicDatabase::HasAlbumInfo(int idAlbum)


bool CMusicDatabase::DeleteAlbumInfo(int idAlbum) bool CMusicDatabase::DeleteAlbumInfo(int idAlbum)
{ {
try if (idAlbum == -1)
{ return false; // not in the database
if (idAlbum == -1) return ExecuteQuery(PrepareSQL("delete from albuminfo where idAlbum=%i",idAlbum));
return false; // not in the database

CStdString strSQL = PrepareSQL("delete from albuminfo where idAlbum=%i",idAlbum);

if (!m_pDS2->exec(strSQL.c_str()))
return false;

return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s - (%i) failed", __FUNCTION__, idAlbum);
}

return false;
} }


bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll) bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)
{ {
try try
{ {
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS2.get()) return false;

if (idArtist == -1) if (idArtist == -1)
return false; // not in the database return false; // not in the database


Expand Down Expand Up @@ -1358,24 +1349,10 @@ bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)


bool CMusicDatabase::DeleteArtistInfo(int idArtist) bool CMusicDatabase::DeleteArtistInfo(int idArtist)
{ {
try if (idArtist == -1)
{ return false; // not in the database
if (idArtist == -1)
return false; // not in the database

CStdString strSQL = PrepareSQL("delete from artistinfo where idArtist=%i",idArtist);

if (!m_pDS2->exec(strSQL.c_str()))
return false;


return true; return ExecuteQuery(PrepareSQL("delete from artistinfo where idArtist=%i",idArtist));
}
catch (...)
{
CLog::Log(LOGERROR, "%s - (%i) failed", __FUNCTION__, idArtist);
}

return false;
} }


bool CMusicDatabase::GetAlbumInfoSongs(int idAlbumInfo, VECSONGS& songs) bool CMusicDatabase::GetAlbumInfoSongs(int idAlbumInfo, VECSONGS& songs)
Expand Down

2 comments on commit 78ad73c

@ronie
Copy link

@ronie ronie commented on 78ad73c Dec 19, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better (hopefully) description of the regression i'm noticing:
when i'm in the music playlist window, bring up the song info dialog and hit the album info button,
xbmc starts to search for album info online instead of display the info already in my musicdb.

@jmarshallnz
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - that can certainly happen. Will remedy.

Please sign in to comment.