Merge pull request #9 from cocor-au-lait/feature/fix-returning-value-on-out-of-index-args

Fix unintended behavior in CubismJson when accessing an index out of bounds
This commit is contained in:
wada
2021-07-27 13:47:51 +09:00
committed by GitHub
2 changed files with 18 additions and 12 deletions

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
* Fix return correct error values for out-of-index arguments in cubismjson.
## [4-r.3] - 2021-06-10 ## [4-r.3] - 2021-06-10

View File

@ -74,7 +74,7 @@ export abstract class Value {
/** /**
* 要素をコンテナで返す(array) * 要素をコンテナで返す(array)
*/ */
public getVector(defaultValue?: csmVector<Value>): csmVector<Value> { public getVector(defaultValue = new csmVector<Value>()): csmVector<Value> {
return defaultValue; return defaultValue;
} }
@ -192,10 +192,8 @@ export abstract class Value {
public static staticInitializeNotForClientCall(): void { public static staticInitializeNotForClientCall(): void {
JsonBoolean.trueValue = new JsonBoolean(true); JsonBoolean.trueValue = new JsonBoolean(true);
JsonBoolean.falseValue = new JsonBoolean(false); JsonBoolean.falseValue = new JsonBoolean(false);
Value.errorValue = new JsonError('ERROR', true);
JsonError.errorValue = new JsonError('ERROR', true); Value.nullValue = new JsonNullvalue();
this.nullValue = new JsonNullvalue();
Value.s_dummyKeys = new csmVector<string>(); Value.s_dummyKeys = new csmVector<string>();
} }
@ -205,13 +203,7 @@ export abstract class Value {
public static staticReleaseNotForClientCall(): void { public static staticReleaseNotForClientCall(): void {
JsonBoolean.trueValue = null; JsonBoolean.trueValue = null;
JsonBoolean.falseValue = null; JsonBoolean.falseValue = null;
JsonError.errorValue = null; Value.errorValue = null;
Value.nullValue = null;
Value.s_dummyKeys = null;
JsonBoolean.trueValue = null;
JsonBoolean.falseValue = null;
JsonError.errorValue = null;
Value.nullValue = null; Value.nullValue = null;
Value.s_dummyKeys = null; Value.s_dummyKeys = null;
} }
@ -970,6 +962,14 @@ export class JsonNullvalue extends Value {
return true; return true;
} }
/**
* Valueにエラー値をセットする
*/
public setErrorNotForClientCall(s: string): Value {
this._stringBuffer = s;
return JsonError.nullValue;
}
/** /**
* コンストラクタ * コンストラクタ
*/ */