check if directories exist
This commit is contained in:
parent
d0c692902a
commit
5fca096252
1 changed files with 6 additions and 1 deletions
|
@ -112,8 +112,11 @@ QPixmap *CardInfo::loadPixmap()
|
||||||
{
|
{
|
||||||
if (pixmap)
|
if (pixmap)
|
||||||
return pixmap;
|
return pixmap;
|
||||||
QString picsPath = db->getPicsPath();
|
|
||||||
pixmap = new QPixmap();
|
pixmap = new QPixmap();
|
||||||
|
QString picsPath = db->getPicsPath();
|
||||||
|
if (!QDir(picsPath).exists())
|
||||||
|
return pixmap;
|
||||||
|
|
||||||
if (getName().isEmpty()) {
|
if (getName().isEmpty()) {
|
||||||
pixmap->load(QString("%1/back.jpg").arg(picsPath));
|
pixmap->load(QString("%1/back.jpg").arg(picsPath));
|
||||||
return pixmap;
|
return pixmap;
|
||||||
|
@ -395,6 +398,8 @@ int CardDatabase::loadFromFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
|
if (!file.isOpen())
|
||||||
|
return -1;
|
||||||
QXmlStreamReader xml(&file);
|
QXmlStreamReader xml(&file);
|
||||||
clear();
|
clear();
|
||||||
while (!xml.atEnd()) {
|
while (!xml.atEnd()) {
|
||||||
|
|
Loading…
Reference in a new issue