1 | Check the return value of query.next(). |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | This may be non-issue since the size of the query was already |
---|
6 | checked. But it seems that query.next() is often checked. This |
---|
7 | one in GetSettingOnHost() wasn't. So I added an if to do that. |
---|
8 | --- |
---|
9 | |
---|
10 | mythtv/libs/libmythdb/mythdb.cpp | 8 +++++--- |
---|
11 | 1 files changed, 5 insertions(+), 3 deletions(-) |
---|
12 | |
---|
13 | |
---|
14 | diff --git a/mythtv/libs/libmythdb/mythdb.cpp b/mythtv/libs/libmythdb/mythdb.cpp |
---|
15 | index 61c9928..a0d789a 100644 |
---|
16 | --- a/mythtv/libs/libmythdb/mythdb.cpp |
---|
17 | +++ b/mythtv/libs/libmythdb/mythdb.cpp |
---|
18 | @@ -413,9 +413,11 @@ QString MythDB::GetSettingOnHost(const QString &key, const QString &host, |
---|
19 | |
---|
20 | if (query.exec() && query.isActive() && query.size() > 0) |
---|
21 | { |
---|
22 | - query.next(); |
---|
23 | - value = query.value(0).toString(); |
---|
24 | - found = true; |
---|
25 | + if (query.next()) |
---|
26 | + { |
---|
27 | + value = query.value(0).toString(); |
---|
28 | + found = true; |
---|
29 | + } |
---|
30 | } |
---|
31 | } |
---|
32 | else |
---|