1
0
Fork 0

Fix returing value on out of index args

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