Fix returing value on out of index args

master
Jun Koyama 2021-06-26 16:55:48 +09:00
parent 50de62e306
commit 0ceff1c8f9
No known key found for this signature in database
GPG Key ID: 04354943629F07D3
1 changed files with 8 additions and 7 deletions

View File

@ -8,6 +8,7 @@
import { CubismIdHandle } from '../id/cubismid'; import { CubismIdHandle } from '../id/cubismid';
import { CubismFramework } from '../live2dcubismframework'; import { CubismFramework } from '../live2dcubismframework';
import { csmString } from '../type/csmstring'; import { csmString } from '../type/csmstring';
import { csmVector } from '../type/csmvector';
import { CubismJson } from '../utils/cubismjson'; import { CubismJson } from '../utils/cubismjson';
// JSON keys // JSON keys
@ -225,12 +226,12 @@ export class CubismMotionJson {
* @return false * @return false
*/ */
public isExistMotionCurveFadeInTime(curveIndex: number): boolean { public isExistMotionCurveFadeInTime(curveIndex: number): boolean {
return !this._json const value = this._json
.getRoot() .getRoot()
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(FadeInTime) .getValueByString(FadeInTime);
.isNull(); return !(value.isNull() || value.isError());
} }
/** /**
@ -240,12 +241,12 @@ export class CubismMotionJson {
* @return false * @return false
*/ */
public isExistMotionCurveFadeOutTime(curveIndex: number): boolean { public isExistMotionCurveFadeOutTime(curveIndex: number): boolean {
return !this._json const value = this._json
.getRoot() .getRoot()
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(FadeOutTime) .getValueByString(FadeOutTime);
.isNull(); return !(value.isNull() || value.isError());
} }
/** /**
@ -287,7 +288,7 @@ export class CubismMotionJson {
.getValueByString(Curves) .getValueByString(Curves)
.getValueByIndex(curveIndex) .getValueByIndex(curveIndex)
.getValueByString(Segments) .getValueByString(Segments)
.getVector() .getVector(new csmVector())
.getSize(); .getSize();
} }