mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-27 00:05:11 +00:00
Update AppModel, ComputerModel, and StreamUtil asserts to cover negative indices
This commit is contained in:
1 parent
2d600c4e6b
commit
4e8fc3aead
3 files changed
+13
-13
No files matched your search
@@ -22,7 +22,7 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Q_ASSERT(index.row() < m_Computers.count());
|
||||
Q_ASSERT(index.row() >= 0 && index.row() < m_Computers.count());
|
||||
|
||||
NvComputer* computer = m_Computers[index.row()];
|
||||
QReadLocker lock(&computer->lock);
|
||||
@@ -116,7 +116,7 @@ QHash<int, QByteArray> ComputerModel::roleNames() const
|
||||
|
||||
Session* ComputerModel::createSessionForCurrentGame(int computerIndex)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_Computers.count());
|
||||
|
||||
NvComputer* computer = m_Computers[computerIndex];
|
||||
|
||||
@@ -136,7 +136,7 @@ Session* ComputerModel::createSessionForCurrentGame(int computerIndex)
|
||||
|
||||
void ComputerModel::deleteComputer(int computerIndex)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_Computers.count());
|
||||
|
||||
beginRemoveRows(QModelIndex(), computerIndex, computerIndex);
|
||||
|
||||
@@ -166,7 +166,7 @@ private:
|
||||
|
||||
void ComputerModel::wakeComputer(int computerIndex)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_Computers.count());
|
||||
|
||||
DeferredWakeHostTask* wakeTask = new DeferredWakeHostTask(m_Computers[computerIndex]);
|
||||
QThreadPool::globalInstance()->start(wakeTask);
|
||||
@@ -174,7 +174,7 @@ void ComputerModel::wakeComputer(int computerIndex)
|
||||
|
||||
void ComputerModel::renameComputer(int computerIndex, QString name)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_Computers.count());
|
||||
|
||||
m_ComputerManager->renameHost(m_Computers[computerIndex], name);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void ComputerModel::testConnectionForComputer(int)
|
||||
|
||||
void ComputerModel::pairComputer(int computerIndex, QString pin)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_Computers.count());
|
||||
|
||||
m_ComputerManager->pairHost(m_Computers[computerIndex], pin);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user