If the primary tenant get evicted then most likely so will you.  Your right of possession depends on his right of possession.  Once he looses his right, then unfortunately, so do you.  Many lease agreement prohibit subletting... so it's possible that he never had the contractual right to sublet to you.  If you really want to stay in this apartment, you need to get permission from the original landlord that has the final say-so and negotiate a written lease agreement with him.  This way, your right to possession is specific to you and not dependent on someone else.