fix skill list null error

This commit is contained in:
Łukasz Góreczny 2021-01-12 10:42:17 +01:00
parent 766b323042
commit 538c58c1e4

View File

@ -1,6 +1,5 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { AbilityViewModel } from '../../../types/viewmodels/ability-viewmodels/AbilityViewModel'; import {CharacterStatsViewModel} from '../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel';
import {CharacterStatsViewModel} from "../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel";
@Component({ @Component({
selector: 'app-ability-card', selector: 'app-ability-card',
@ -15,12 +14,16 @@ export class AbilityCardComponent implements OnInit {
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
this.ability.skills.sort((a, b) => (a.name > b.name ? 1 : -1)); debugger
console.log(this.ability.skills);
if (this.ability.skills != null) {
this.ability.skills.sort((a, b) => (a.name > b.name ? 1 : -1));
}
this.changeColors(); this.changeColors();
} }
changeColors(){ changeColors() {
switch(this.ability.name){ switch (this.ability.name) {
case 'Charisma': case 'Charisma':
this.headStyle.bgColor = '#FFEB85'; this.headStyle.bgColor = '#FFEB85';
break; break;