HIV is not transmitted by masturbation.
HIV is unable to reproduce outside its living host (unlike many bacteria or fungi, which may do so under suitable conditions), except under laboratory conditions; therefore, it does not spread or maintain infectiousness outside its host.
HIV is transmitted by;
Unprotected penetrative anal and/or vaginal sex
Sharing works with other IV drug users
Mother to child
Hiv can only be transmitted through :
-unprotected vaginal or/and anal penetration
-from mother to child
-by sharing drug works
Apparently you are not exposed
Keep calm