<div><div dir="auto">That worked. Thanks </div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 4, 2019 at 12:19 PM Jon Siwek <<a href="mailto:jsiwek@corelight.com">jsiwek@corelight.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Apr 4, 2019 at 8:59 AM Woot4moo <<a href="mailto:tscheponik@gmail.com" target="_blank">tscheponik@gmail.com</a>> wrote:<br>
><br>
> How can one reference a potentially missing key such that the script will not terminate? For example in a file_new event, if I reference the mime_type attribute and it is uninitialized I receive “no such field in record”<br>
><br>
> Example code below:<br>
><br>
> if( f?$mime_type) #error here<br>
<br>
That's the correct way to check for uninitialized &optional values,<br>
but the error here is saying there's "no such field", not that the<br>
"field is uninitialized. i.e. there is no "mime_type" field in the<br>
"fa_file" record type. You're probably meaning to access<br>
f$info$mime_type, which gets populated via the "file_sniff" event's<br>
"fa_metadata" record's "mime_type" field.<br>
<br>
(You can check if a record contains a field name by using the<br>
"record_fields" function to introspect, but that's not a typical thing<br>
people do and likely not what you really want).<br>
<br>
- Jon<br>
</blockquote></div></div>