Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Generally "null is not an object" handling?

$
0
0

Hi guys,

 

I want to find and change some textlayers in my compositions but it wont work when the layer isnt in there.

 

var layer = app.project.item(1).layer("layername").sourceText.value;

 

When layername is found, everything is okay, but when no layer has this name, came the errormessage "null is not an object" and the script stops.

I tried a try-catch and a if-condition but the error is still the same.

 

How can I generally avoid this message and can handle this behavior?

When no layer is found, the script should message the user and do other functions while when the layer is found.

 

 

cheers.


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>