HPCC-12158 Check ptree pointer before use in addClusterQueryStates

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>