Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b2103db

Browse files
[[ Bug 13146 ]] Print to PDF fails in 7DP9
1 parent f91ae3b commit b2103db

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

docs/notes/bugfix-13146.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Print to PDF fails in 7DP9

engine/src/customprinter.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,11 +1182,20 @@ static bool convert_options_array(void *p_context, MCArrayRef p_array, MCNameRef
11821182

11831183
if (!MCStringConvertToCString(MCNameGetString(p_key), ctxt -> option_keys[ctxt -> index]))
11841184
return false;
1185+
1186+
// SN-2014-08-11: [[ Bug 13146 ]] Also allow NameRef to be passed as options.
1187+
MCAutoStringRef t_value;
1188+
if (MCValueGetTypeCode(p_value) == kMCValueTypeCodeName)
1189+
t_value = MCNameGetString((MCNameRef)p_value);
1190+
else if (MCValueGetTypeCode(p_value) == kMCValueTypeCodeString)
1191+
t_value = (MCStringRef)p_value;
1192+
else
1193+
{
1194+
ctxt -> option_values[ctxt -> index] = NULL;
1195+
return false;
1196+
}
11851197

1186-
if (MCValueGetTypeCode(p_value) != kMCValueTypeCodeString)
1187-
return false;
1188-
1189-
if (!MCStringConvertToCString((MCStringRef)p_value, ctxt -> option_values[ctxt -> index]))
1198+
if (!MCStringConvertToCString(*t_value, ctxt -> option_values[ctxt -> index]))
11901199
return false;
11911200

11921201
ctxt -> index += 1;

0 commit comments

Comments
 (0)