Asserts if QString parameters are empty

This commit is contained in:
Samuel Gaist 2014-11-06 00:52:36 +01:00
parent 6733abfc2e
commit 2acfd26494

View File

@ -90,55 +90,50 @@ bool QSimpleUpdater::newerVersionAvailable() const {
return m_new_version_available; return m_new_version_available;
} }
// Change the download URL if the issued URL is valid
void QSimpleUpdater::setDownloadUrl(const QString &url) { void QSimpleUpdater::setDownloadUrl(const QString &url) {
// Change the download URL if the issued URL is valid Q_ASSERT(!url.isEmpty());
if (!url.isEmpty()) { if (!url.isEmpty()) {
m_download_url.setUrl(url); m_download_url.setUrl(url);
} } else {
// The issued URL is ilegal, so we warn the user
else {
qWarning() << "QSimpleUpdater: input URL cannot be empty!"; qWarning() << "QSimpleUpdater: input URL cannot be empty!";
} }
} }
// Change the reference URL if the issued URL is valid
void QSimpleUpdater::setReferenceUrl(const QString &url) { void QSimpleUpdater::setReferenceUrl(const QString &url) {
// Change the reference URL if the issued URL is valid Q_ASSERT(!url.isEmpty());
if (!url.isEmpty()) { if (!url.isEmpty()) {
m_reference_url.setUrl(url); m_reference_url.setUrl(url);
} } else {
// The issued URL is ilegal, so we warn the user
else {
qWarning() << "QSimpleUpdater: input URL cannot be empty!"; qWarning() << "QSimpleUpdater: input URL cannot be empty!";
} }
} }
// Change the changelog URL if the issued URL is valid
void QSimpleUpdater::setChangelogUrl(const QString &url) { void QSimpleUpdater::setChangelogUrl(const QString &url) {
// Change the changelog URL if the issued URL is valid Q_ASSERT(!url.isEmpty());
if (!url.isEmpty()) { if (!url.isEmpty()) {
m_changelog_url.setUrl(url); m_changelog_url.setUrl(url);
} } else {
// The issued URL is ilegal, so we warn the user
else {
qWarning() << "QSimpleUpdater: input URL cannot be empty!"; qWarning() << "QSimpleUpdater: input URL cannot be empty!";
} }
} }
// Change the installed application version if the issued string is valid
void QSimpleUpdater::setApplicationVersion(const QString &version) { void QSimpleUpdater::setApplicationVersion(const QString &version) {
// Change the installed application version if the issued string is valid Q_ASSERT(!version.isEmpty());
if (!version.isEmpty()) { if (!version.isEmpty()) {
m_installed_version = version; m_installed_version = version;
} } else {
// The application version cannot be empty, so we warn the user
else {
qWarning() << "QSimpleUpdater: input string cannot be empty!"; qWarning() << "QSimpleUpdater: input string cannot be empty!";
} }
} }
void QSimpleUpdater::checkDownloadedVersion(QNetworkReply *reply) { void QSimpleUpdater::checkDownloadedVersion(QNetworkReply *reply) {
bool _new_update = false; bool _new_update = false;