Change bool/int condition
This commit is contained in:
@@ -282,13 +282,16 @@ QVariant DeviceManager::data(const QModelIndex &idx, int role) const {
|
||||
switch (role) {
|
||||
case Qt::DisplayRole: {
|
||||
QString text;
|
||||
if (!info->friendly_name_.isEmpty())
|
||||
if (!info->friendly_name_.isEmpty()) {
|
||||
text = info->friendly_name_;
|
||||
else if (info->BestBackend())
|
||||
}
|
||||
else if (info->BestBackend()) {
|
||||
text = info->BestBackend()->unique_id_;
|
||||
}
|
||||
|
||||
if (info->size_)
|
||||
if (info->size_ > 0) {
|
||||
text = text + QString(" (%1)").arg(Utilities::PrettySize(info->size_));
|
||||
}
|
||||
if (info->device_.get()) info->device_->Refresh();
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -117,8 +117,9 @@ bool MtpConnection::GetSupportedFiletypes(QList<Song::FileType> *ret) {
|
||||
uint16_t *list = nullptr;
|
||||
uint16_t length = 0;
|
||||
|
||||
if (LIBMTP_Get_Supported_Filetypes(device_, &list, &length) || !list || !length)
|
||||
if (LIBMTP_Get_Supported_Filetypes(device_, &list, &length) != 0 || !list || !length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; ++i) {
|
||||
switch (LIBMTP_filetype_t(list[i])) {
|
||||
|
||||
@@ -255,7 +255,7 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType> *ret, LIBMTP_mtpdevi
|
||||
uint16_t *list = nullptr;
|
||||
uint16_t length = 0;
|
||||
|
||||
if (LIBMTP_Get_Supported_Filetypes(device, &list, &length) || !list || !length)
|
||||
if (LIBMTP_Get_Supported_Filetypes(device, &list, &length) != 0 || !list || !length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < length; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user