diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-02-01 18:58:49 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-02-01 18:58:49 +0000 |
| commit | e662c2f44050ad66b56e5c2321e7a20b57ed628f (patch) | |
| tree | 8fde885ea902340095b663103c28a2ef1cde01ae | |
| parent | 23ca6b1444c69d5115d70d203db346204e6b44fc (diff) | |
| download | qmmp-e662c2f44050ad66b56e5c2321e7a20b57ed628f.tar.gz qmmp-e662c2f44050ad66b56e5c2321e7a20b57ed628f.tar.bz2 qmmp-e662c2f44050ad66b56e5c2321e7a20b57ed628f.zip | |
fixed segmentation fault
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@773 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 7 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.h | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index cb3907aac..efcf2cbd7 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright(C) 2006-2008 by Ilya Kotov * + * Copyright(C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -126,6 +126,11 @@ PlayListItem* PlayListModel::currentItem() return m_items.at(qMin(m_items.size() - 1, m_current)); } +PlayListItem* PlayListModel::item(int row) const +{ + return (row < m_items.size() && row >= 0) ? m_items.at(row) : 0; +} + int PlayListModel::currentRow() { return m_current; diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index 3c2ca50f7..e90bc007c 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2008 by Ilya Kotov * + * Copyright (C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -90,14 +90,11 @@ public: int count(); PlayListItem* currentItem(); - int row(PlayListItem* item)const + int row(PlayListItem* item) const { return m_items.indexOf(item); } - PlayListItem* item(int row)const - { - return m_items.at(row); - } + PlayListItem* item(int row) const; int currentRow(); bool setCurrent (int); bool isSelected(int); |
