mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-19 13:23:55 -07:00
fix bug with uploading unnamed decks ignoring the prompt (#5313)
This commit is contained in:
parent
705b1e0c2b
commit
0234a70bfd
1 changed files with 7 additions and 7 deletions
|
|
@ -176,14 +176,8 @@ void TabDeckStorage::actUpload()
|
||||||
QFile deckFile(filePath);
|
QFile deckFile(filePath);
|
||||||
QFileInfo deckFileInfo(deckFile);
|
QFileInfo deckFileInfo(deckFile);
|
||||||
|
|
||||||
QString deckString;
|
|
||||||
DeckLoader deck;
|
DeckLoader deck;
|
||||||
bool error = !deck.loadFromFile(filePath, DeckLoader::CockatriceFormat);
|
if (!deck.loadFromFile(filePath, DeckLoader::CockatriceFormat)) {
|
||||||
if (!error) {
|
|
||||||
deckString = deck.writeToString_Native();
|
|
||||||
error = deckString.length() > MAX_FILE_LENGTH;
|
|
||||||
}
|
|
||||||
if (error) {
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Invalid deck file"));
|
QMessageBox::critical(this, tr("Error"), tr("Invalid deck file"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -202,6 +196,12 @@ void TabDeckStorage::actUpload()
|
||||||
deck.setName(deck.getName().left(MAX_NAME_LENGTH));
|
deck.setName(deck.getName().left(MAX_NAME_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString deckString = deck.writeToString_Native();
|
||||||
|
if (deckString.length() > MAX_FILE_LENGTH) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Invalid deck file"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Command_DeckUpload cmd;
|
Command_DeckUpload cmd;
|
||||||
cmd.set_path(targetPath.toStdString());
|
cmd.set_path(targetPath.toStdString());
|
||||||
cmd.set_deck_list(deckString.toStdString());
|
cmd.set_deck_list(deckString.toStdString());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue