Skip to content

Commit

Permalink
Fix issue using String.concat with flash strings (fix #2268)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 6, 2023
1 parent 4f0d396 commit ffd2ce1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
nRF52: bootloader asks for connection interval 7.5->30ms now, not just 15ms. Should improve DFU on iOS 16 which doesn't honour 15ms request
Fix unicode in object keys when UTF8 support enabled, eg. {'\u00e4':1}
Bangle.js: Change order of items in the Recovery Menu (hold BTN at boot) to put more common options first
Tidying up error messages (no trailing '.' or '\n'), making almost-similar error messages the same
Tidying up error messages (no trailing '.' or '\n'), making almost-similar error messages the same
Fix issue using `String.concat` with flash strings (fix #2268)

2v19 : Fix Object.values/entries for numeric keys after 2v18 regression (fix #2375)
nRF52: for SD>5 use static buffers for advertising and scan response data (#2367)
Expand Down
4 changes: 3 additions & 1 deletion src/jswrap_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,9 @@ original `String`.
*/
JsVar *jswrap_string_concat(JsVar *parent, JsVar *args) {
if (!jsvIsString(parent)) return 0;
JsVar *str = jsvNewFromStringVar(parent, 0, JSVAPPENDSTRINGVAR_MAXLENGTH);
// don't use jsvNewFromStringVar here because it has an optimisation for Flash Strings that just clones (rather than copying)
JsVar *str = jsvNewFromEmptyString();
jsvAppendStringVarComplete(str, parent);
JsVar *extra = jsvArrayJoin(args, NULL/*filler*/, false/*ignoreNull*/);
jsvAppendStringVarComplete(str, extra);
jsvUnLock(extra);
Expand Down

0 comments on commit ffd2ce1

Please sign in to comment.