diff --git a/CHANGELOG.md b/CHANGELOG.md index fdbbb2c..bb38e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/). +## [Unreleased] + +### Fixed + +* Fix return correct error values for out-of-index arguments in cubismjson. + ## [4-r.3] - 2021-06-10 diff --git a/src/utils/cubismjson.ts b/src/utils/cubismjson.ts index 93a41a3..d8097a0 100644 --- a/src/utils/cubismjson.ts +++ b/src/utils/cubismjson.ts @@ -74,7 +74,7 @@ export abstract class Value { /** * 要素をコンテナで返す(array) */ - public getVector(defaultValue?: csmVector): csmVector { + public getVector(defaultValue = new csmVector()): csmVector { return defaultValue; } @@ -192,10 +192,8 @@ export abstract class Value { public static staticInitializeNotForClientCall(): void { JsonBoolean.trueValue = new JsonBoolean(true); JsonBoolean.falseValue = new JsonBoolean(false); - - JsonError.errorValue = new JsonError('ERROR', true); - this.nullValue = new JsonNullvalue(); - + Value.errorValue = new JsonError('ERROR', true); + Value.nullValue = new JsonNullvalue(); Value.s_dummyKeys = new csmVector(); } @@ -205,13 +203,7 @@ export abstract class Value { public static staticReleaseNotForClientCall(): void { JsonBoolean.trueValue = null; JsonBoolean.falseValue = null; - JsonError.errorValue = null; - Value.nullValue = null; - Value.s_dummyKeys = null; - - JsonBoolean.trueValue = null; - JsonBoolean.falseValue = null; - JsonError.errorValue = null; + Value.errorValue = null; Value.nullValue = null; Value.s_dummyKeys = null; } @@ -970,6 +962,14 @@ export class JsonNullvalue extends Value { return true; } + /** + * Valueにエラー値をセットする + */ + public setErrorNotForClientCall(s: string): Value { + this._stringBuffer = s; + return JsonError.nullValue; + } + /** * コンストラクタ */