Skip to content
Snippets Groups Projects
Commit aa258686 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

bbs.revert_text() (called with no args) is supposed to revert all text strings

and not throw and exception. :-(

This was broken in commit 6dbd2fec

Caught by code review.
parent 1c718743
No related branches found
No related tags found
No related merge requests found
Pipeline #8040 passed
...@@ -1588,15 +1588,13 @@ static JSBool ...@@ -1588,15 +1588,13 @@ static JSBool
js_revert_text(JSContext *cx, uintN argc, jsval *arglist) js_revert_text(JSContext *cx, uintN argc, jsval *arglist)
{ {
jsval * argv = JS_ARGV(cx, arglist); jsval * argv = JS_ARGV(cx, arglist);
uint32 i = 0; uint32 i = TOTAL_TEXT;
sbbs_t* sbbs; sbbs_t* sbbs;
if ((sbbs = js_GetPrivate(cx, JS_THIS_OBJECT(cx, arglist))) == NULL) if ((sbbs = js_GetPrivate(cx, JS_THIS_OBJECT(cx, arglist))) == NULL)
return JS_FALSE; return JS_FALSE;
if (js_argcIsInsufficient(cx, argc, 1)) if (argc > 0) {
return JS_FALSE;
if (JSVAL_IS_NUMBER(argv[0])) { if (JSVAL_IS_NUMBER(argv[0])) {
if (!JS_ValueToECMAUint32(cx, argv[0], &i)) if (!JS_ValueToECMAUint32(cx, argv[0], &i))
return JS_FALSE; return JS_FALSE;
...@@ -1610,6 +1608,7 @@ js_revert_text(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1610,6 +1608,7 @@ js_revert_text(JSContext *cx, uintN argc, jsval *arglist)
i = sbbs->get_text_num(id); i = sbbs->get_text_num(id);
free(id); free(id);
} }
}
if (i >= TOTAL_TEXT) { if (i >= TOTAL_TEXT) {
for (i = 0; i < TOTAL_TEXT; i++) { for (i = 0; i < TOTAL_TEXT; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment