Appeal by the defendant from a judgment of the County Court, Suffolk County (Condon, J.), rendered February 25, 2009, convicting him of criminal possession of a controlled substance in the seventh degree, upon a jury verdict, and imposing sentence.
*534Ordered that the judgment is affirmed, and the matter is remitted to the County Court, Suffolk County for further proceedings pursuant to CPL 460.50 (5).
The trial court properly declined the defendant’s request to charge the jury with the affirmative defense of entrapment since no reasonable view of the evidence supported that defense (see Penal Law § 40.05; People v Butts, 72 NY2d 746, 750 [1988]; People v Garcia, 66 AD3d 699 [2009]; People v Skervin, 17 AD3d 771, 771-772 [2005]). Contrary to the defendant’s contention, the evidence demonstrated that undercover detectives merely afforded the defendant the opportunity to commit the subject offense, which, standing alone, was insufficient to warrant an entrapment charge (see People v Broum, 82 NY2d 869, 871-872 [1993]; People v Vega, 23 AD3d 504, 505 [2005]; People v Moultrie, 5 AD3d 241, 242 [2004]; People v Delaney, 309 AD2d 968 [2003]).
Contrary to the defendant’s contention, the County Court did not improvidently exercise its discretion in closing the courtroom to all but the defendant’s family during the testimony of a detective. The detective testified at a Hinton hearing (see People v Hinton, 31 NY2d 71 [1972], cert denied 410 US 911 [1973]) that she recently had worked undercover on several cases with the other undercover officer testifying at trial, that they had identified a suspect who had not yet been arrested, and that her safety and the safety of that other officer, as well as the open case on which they jointly had worked, would be jeopardized if her identity was revealed (see People v Hodge, 53 AD3d 507 [2008]; People v Owens, 43 AD3d 1185, 1186 [2007]; People v Mendez, 5 AD3d 400, 401 [2004]).
The defendant’s remaining contention is without merit. Rivera, J.E, Balkin, Austin and Roman, JJ., concur.