A judge has given Tory Lanez one last chance to stay out of jail.
Lanez, real name Daystar Peterson, was allegedly within 100 yards of Megan when rapper DaBaby brought him out onstage at Rolling Loud festival in Miami.
Prosecutors filed a motion asking a judge to hold Tory in contempt of court for violating a restraining order by getting too close to the "Savage" rapper.
However, the judge let the rapper off with a warning to stay away from Megan, according to TMZ. The judge also modified his bail conditions to specifically prohibit him from attending any events where Megan might be.
That means he has to check ahead of time to see if she is scheduled to attend an event that he is planning to attend. If she is there -- even if its a paid gig for Tory -- he has to cancel his appearance.
The judge also said if he violates the restraining order again, he will be remanded into custody. This is his last and final warning.
Tory was charged with felony assault last year for allegedly shooting Megan in the foot following a party in Los Angeles.