Putting Skill name in a variable and getting an error?

I'm trying to store the name of the first Skill an Actor has, in a variable. Variable 68 is the Actor ID.

I've put in the following:

◆If:Script:$dataSkills[$gameActors.actor($gameVariables.value(68))._skills[0]].name === null
◆Control Variables:#0090 Party Member Skill = 50
◆
:Else
◆Script:let skillname = $dataSkills[$gameActors.actor($gameVariables.value(68))._skills[0]].name;
: :$gameVariables.setValue(90, skillname);
◆
:End

(By the way, the skill name of Skill 50 is "None".)

I thought this would allow me to get past an Actor who has no Skill, but I get the error "Cannot read property 'name' of undefined". However, it DOES work when the Actor has a Skill. Help please!

EDIT:I figured it out. I made the conditional branch check how many skills an actor had with this $gameActors.actor(1).skills().length. If 0 then (stuff) if not 0 then (different stuff)

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/putting-skill-name-in-a-variable-and-getting-an-error.127520/