Commit 5684600f authored by twanvl's avatar twanvl

fixed: errors in templates could cause program to hang/crash

parent d2666705
...@@ -108,6 +108,9 @@ void StylePanel::selectCard(const CardP& card) { ...@@ -108,6 +108,9 @@ void StylePanel::selectCard(const CardP& card) {
void StylePanel::onStyleSelect(wxCommandEvent&) { void StylePanel::onStyleSelect(wxCommandEvent&) {
if (list->hasSelection() && card) { if (list->hasSelection() && card) {
StyleSheetP stylesheet = list->getSelection<StyleSheet>(); StyleSheetP stylesheet = list->getSelection<StyleSheet>();
if (stylesheet->game != set->game) {
throw PackageError(_("Stylesheet made for the wrong game"));
}
if (stylesheet == set->stylesheet) { if (stylesheet == set->stylesheet) {
// select no special style when selecting the same style as the set default // select no special style when selecting the same style as the set default
stylesheet = StyleSheetP(); stylesheet = StyleSheetP();
......
...@@ -21,7 +21,7 @@ IMPLEMENT_VALUE_VIEWER(Image); ...@@ -21,7 +21,7 @@ IMPLEMENT_VALUE_VIEWER(Image);
void ImageValueViewer::draw(RotatedDC& dc) { void ImageValueViewer::draw(RotatedDC& dc) {
// reset? // reset?
int w = (int)dc.trX(style().width), h = (int)dc.trY(style().height); int w = max(0,(int)dc.trX(style().width)), h = max(0,(int)dc.trY(style().height));
int a = dc.trAngle(0); //% TODO : Add getAngle()? int a = dc.trAngle(0); //% TODO : Add getAngle()?
if (bitmap.Ok() && (a != angle || size.width != w || size.height != h)) { if (bitmap.Ok() && (a != angle || size.width != w || size.height != h)) {
bitmap = Bitmap(); bitmap = Bitmap();
......
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