fixed potential null pointer

Fixes a null pointer that sometimes happens during workspace tests.