Hard to tell what your code does with only this small piece. Please use code tags to keep code formatting.
What does the code do if ps==null?