pal: check the vector size before use it to avoid crash

if the vector already be free, it will crash when using it.
so we should check the vector size whether is valid first.

Change-Id: I3d8c251936e8199f27d489193b888696e758a4dc
1 file changed