Skip to content

Commit

Permalink
fix/no deck empty settings (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu authored Jul 15, 2023
1 parent 6c422fb commit c1b007a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib/parser/DeckParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,14 @@ export class DeckParser {
const exporter = this.setupExporter(this.payload, ws.location);

this.payload = fallback.run(this.settings);
if (
!this.payload ||
this.payload.length === 0 ||
this.totalCardCount() === 0
) {
throw NO_PACKAGE_ERROR;
}

this.payload[0].settings = this.settings;
exporter.configure(this.payload);

Expand All @@ -570,9 +578,6 @@ export async function PrepareDeck(

if (parser.totalCardCount() === 0) {
const apkg = await parser.tryExperimental();
if (parser.totalCardCount() === 0) {
throw NO_PACKAGE_ERROR;
}
return {
name: `${parser.name ?? fileName}.apkg`,
apkg,
Expand Down

0 comments on commit c1b007a

Please sign in to comment.