"null pointer dereference "error

In reply to chandnidodiya:

Are you sure pt1/pt2 are cvlass objects?
See

    pt1 = phy_dataQ[i];
    pt2 = phy_dataQ[j];

All what you are doing with

phy_dataQ

looks like a queue.