Permalink
Browse files

ensure we check ptrs in several MusicDatabase routines. part of #13766

  • Loading branch information...
Jonathan Marshall
Jonathan Marshall committed Dec 18, 2012
1 parent f7d761e commit 78ad73c239399834514a23f74f01718eb55c29db
Showing with 12 additions and 35 deletions.
  1. +12 −35 xbmc/music/MusicDatabase.cpp
@@ -1234,6 +1234,9 @@ bool CMusicDatabase::GetAlbumInfo(int idAlbum, CAlbum &info, VECSONGS* songs, bo
{
try
{
+ if (NULL == m_pDB.get()) return false;
+ if (NULL == m_pDS2.get()) return false;
+
if (idAlbum == -1)
return false; // not in the database
@@ -1289,30 +1292,18 @@ bool CMusicDatabase::HasAlbumInfo(int idAlbum)
bool CMusicDatabase::DeleteAlbumInfo(int idAlbum)
{
- try
- {
- if (idAlbum == -1)
- 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;
+ if (idAlbum == -1)
+ return false; // not in the database
+ return ExecuteQuery(PrepareSQL("delete from albuminfo where idAlbum=%i",idAlbum));
}
bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)
{
try
{
+ if (NULL == m_pDB.get()) return false;
+ if (NULL == m_pDS2.get()) return false;
+
if (idArtist == -1)
return false; // not in the database
@@ -1358,24 +1349,10 @@ bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)
bool CMusicDatabase::DeleteArtistInfo(int idArtist)
{
- try
- {
- 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;
+ if (idArtist == -1)
+ return false; // not in the database
- return true;
- }
- catch (...)
- {
- CLog::Log(LOGERROR, "%s - (%i) failed", __FUNCTION__, idArtist);
- }
-
- return false;
+ return ExecuteQuery(PrepareSQL("delete from artistinfo where idArtist=%i",idArtist));
}
bool CMusicDatabase::GetAlbumInfoSongs(int idAlbumInfo, VECSONGS& songs)

2 comments on commit 78ad73c

@ronie

This comment has been minimized.

Show comment Hide comment
@ronie

ronie Dec 19, 2012

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.

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

This comment has been minimized.

Show comment Hide comment
@jmarshallnz

jmarshallnz Dec 19, 2012

Owner

Right - that can certainly happen. Will remedy.

Owner

jmarshallnz replied Dec 19, 2012

Right - that can certainly happen. Will remedy.

Please sign in to comment.