Commit a98bcb50 authored by twanvl's avatar twanvl

Fixed crash when copying cards with has_styling

parent 1d5be59a
......@@ -67,6 +67,8 @@ IMPLEMENT_REFLECTION(Card) {
} else if (stylesheet_for_reading()) {
REFLECT_IF_READING styling_data.init(stylesheet_for_reading()->styling_fields);
REFLECT(styling_data);
} else if (tag.reading()) {
has_styling = false; // We don't know the style, this can be because of copy/pasting
}
}
REFLECT(notes);
......
......@@ -11,6 +11,7 @@
#include <data/card.hpp>
#include <data/set.hpp>
#include <data/game.hpp>
#include <data/stylesheet.hpp>
#include <data/keyword.hpp>
#include <util/io/package.hpp>
#include <script/scriptable.hpp>
......@@ -59,7 +60,15 @@ wxDataFormat CardDataObject::format = _("application/x-mse-card");
CardDataObject::CardDataObject(const SetP& set, const CardP& card) {
WrappedCard data = { set->game.get(), set->game->name(), card };
bool has_styling = card->has_styling && !card->stylesheet;
if (has_styling) {
// set the stylsheet, so when deserializing we know whos style options we are reading
card->stylesheet = set->stylesheet;
}
SetText(serialize_for_clipboard(*set, data));
if (has_styling) {
card->stylesheet = StyleSheetP(); // restore card
}
SetFormat(format);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment