CXone Studio DBConnector: Handling empty result sets in ASSIGN action

I’m trying to pull a record from our custom DB using the DBConnector action in a CXone Studio script. The SQL query works fine in the test tool, but when the script runs and no row is found, the subsequent ASSIGN action throws a null reference error. I’ve tried wrapping the lookup in an IF block to check if the result count is greater than zero, but the variable seems to be uninitialized if the query returns nothing. How do I safely handle a missing record without the script crashing? Here’s the snippet I’m using for the assignment.