Re #5983. Check if sample is null.
Merge branch 'bugfix/5983_simple_instrument_crash' into develop