Avoid warning if -1 fed to List.GetItemAtIndex?

Even though my graph works well this way, I’d like to not generate a warning on this node if it gets fed -1.

Please suggest a workaround.

Hi Truevis,

maybe you can get the value to positive, would it help?

[quote=“Mauro, post:2, topic:7504”]
maybe you can get the value to positive
[/quote]That’s a good idea. I get whatever value is at the 1th element of the list, though. I like the null return; I just don’t want the warning.

you could try some ds:

def smartget1(l1:var[], i){
return = [Imperative]{
    if (List.ContainsItem(GetKeys(l1), i) )
    {
        return = List.GetItemAtIndex(l1, i);
    }
    else
    {
        return = null;
    }
}};
3 Likes