Why did nobody sue them?
Because they're not idiots and they got permission first?
A quick websearch turns up articles with McFarlane talking about how he did get permission from Lucas to do a Star Wars spoof on the show but hadn't yet managed to get Paramount to agree to let him use Star Trek. (at least at the time - I don't watch the show, I don't know if he did later)
Unless you know for a *fact* that they did not ask, don't assume.
Looks like they don't always get permission
Source: Wikipedia
Lawsuits
In March 2007 comedian Carol Burnett filed a $6 million lawsuit against 20th Century Fox, claiming that her charwoman character had been portrayed on the show without her permission. She stated it was a trademark infringement, and that Fox violated her publicity rights.[69][70][71] On June 4, 2007, United States District Judge Dean D. Pregerson rejected the lawsuit, stating that the parody was protected under the First Amendment, citing Hustler Magazine v. Falwell as a precedent.[72]
On October 3, 2007, Bourne Co. Music Publishers filed a lawsuit accusing the show of infringing its copyright on the song "When You Wish upon a Star", through a parody song entitled "I Need a Jew" appearing in the episode "When You Wish Upon a Weinstein". Bourne Co., the sole United States copyright owner of the song, alleged the parody pairs a "thinly veiled" copy of their music with antisemitic lyrics. Named in the suit were 20th Century Fox Film Corp., Fox Broadcasting Co., Cartoon Network, MacFarlane, and Murphy; the suit sought to stop the program's distribution and asked for unspecified damages.[73] Bourne argued that "I Need a Jew" uses the copyrighted melody of "When You Wish Upon a Star" without commenting on that song, and that it was therefore not a First Amendment-protected parody per the ruling in Campbell v. Acuff-Rose Music, Inc.[74][75] On March 16, 2009, United States District Judge Deborah Batts held that Family Guy did not infringe on Bourne's copyright when it transformed the song for comical use in an episode.[76]
In December 2007, Family Guy was again accused of copyright infringement when actor Art Metrano filed a lawsuit regarding a scene in Stewie Griffin: The Untold Story, in which Jesus performs Metrano's signature "magic" act involving absurd "faux" magical hand gestures while humming the distinctive tune "Fine and Dandy".[77] 20th Century Fox, MacFarlane, Callaghan, and Borstein were all named in the suit.[78] In July 2009 a federal district court judge rejected Fox's motion to dismiss, saying that the first three fair use factors involved—"purpose and character of the use", "nature of the infringed work", and "amount and substantiality of the taking"—counted in Metrano's favor, while the fourth—"economic impact"—had to await more fact-finding. In denying the dismissal, the court held that the reference in the scene made light of Jesus and his followers—not Metrano or his act.