Image copyright Reuters Image caption Carrie Fisher will still appear in Star Wars: Episode IX

The death of an actor during a film's production forces movie executives to question what to do next - so how do Hollywood studios handle the issue?

Carrie Fisher will still appear in Star Wars: Episode IX, according to her brother, Todd.

But instead of using CGI to slot her into the film - as was the case with Peter Cushing in Star Wars spin-off Rogue One - archive footage of the actress, who died in December, will be used instead.

It won't be the first film to have been affected by the death of one of its major stars during production.

Don Rickles, better known as the voice of Mr Potato Head in the Toy Story films, died last week without having completed his dialogue for the fourth film in the franchise, so a new voice actor will have to be found.

Image copyright Reuters/Shutterstock Image caption Rickles voiced Mr Potato Head in the Toy Story films

Other examples include Philip Seymour Hoffman, who had seven days left of filming on the final Hunger Games when he died from a drug overdose.

There was also Oliver Reed, who died during the filming of Gladiator in 1999; Heath Ledger, who died in 2008 while working on The Imaginarium of Doctor Parnassus; and Brandon Lee, who was fatally wounded in an accident on the set of The Crow in 1993.

Each film employed different methods to continue production, including script rewrites, using digital visual effects and having new actors take over the role.

In the case of Gladiator, the film was rewritten to include previously filmed footage of Reed, along with a body double for wider shots. The double's head was digitally replaced with that of the late actor.

Visual effects supervisor Rob Harvey, who won an Oscar for his work on the film and now runs his own special effects company, was jointly responsible for recreating Reed on screen.

Image copyright Dreamworks Image caption A body double was used to help complete Oliver Reed's scenes in 2000 release Gladiator

"When he died we had to make sense of the whole end of the film," he says. "It's a very weird thing to have to do - particularly then, when the technology wasn't really there at all.

"I sat down with the editor and went through all the rushes of Oliver. We had to find lines that were dropped and takes that weren't used to piece together a coherent sequence.

"We had to shoot pick-ups of Russell [Crowe] on a green screen and another of doors and bars so [Oliver] could speak to Russell through them, and we had to basically cut his performance out of it all.

"We only manipulated his beard [for continuity], but it was his head cut out and stuck on to the body double. Then we just mucked around with the cut as much as we could to make it work.

"It was a clever bit of directing and scriptwriting. We just tried to do it as tastefully as possible."

Harvey also worked on Terry Gilliam's Doctor Parnassus film, in which Johnny Depp, Colin Farrell and Jude Law stepped in to play Ledger's character in various reshot parts of the film.

"With a film like that it looked like the whole thing was going to collapse," says Harvey. "But being a Gilliam movie, you can have anyone do anything."

Image copyright Lionsgate Image caption The Imaginarium of Doctor Parnassus saw other actors replace the late Heath Ledger on screen

It's a costly business. But in most cases, productions will be covered for any necessary reworking by extensive insurance policies, enabling them to effectively remake the film from scratch if need be.

Standard feature film production insurance includes cast cover where, in the event of illness or injury, losses arising will be paid.

"Most of the time someone breaks a leg and you have to stand down a week or two because you can't film until the person is better," explains Matthew Torrible, director of TV and film specialists Quartz Insurance Brokers Ltd.

"In the event of a death, the insurance will either pay for you to fix it and then edit; pay to reshoot with another person and the necessary rewrites; or pay for the abandonment which pays for all the money production companies have invested up to that point."

Insurance companies may not pay out if the cause of death is linked to any previous medical history disclosed during required health checks and therefore excluded from the policy.

However, it is possible to insure against specific exclusions to mitigate that risk.

Actors who died mid-production

Image copyright Getty Images Image caption Aaliyah was due to star in The Matrix Reloaded

Marilyn Monroe, 1962 Something's Got to Give - never completed

Bruce Lee, 1973 Game of Death - incomplete version was initially released followed by 1978 feature-length release using new footage shot after his death

Natalie Wood, 1981 Brainstorm - completed using stand-in

River Phoenix, 1993 Dark Blood - completed with stills

Chris Farley, 1997 Shrek - recast with Mike Myers voicing title role

Aaliyah, 2001 The Matrix Reloaded - recast with Nona Gaye as Zee

Paul Walker, 2013 Fast & Furious 7 - completed with body doubles, including Walker's brothers

According to Torrible, it is very rare for a film to be abandoned "because there's a big commercial drive to get the production finished".

But Rob Harvey is wary of the notion of creating a wholly computer-generated actor.

"Doing a digital version of somebody other than [in] a very wide shot is a bit of a strange one," he says. "They've got a problem to solve and I guess it's up to them how to solve it.

"You can build a CG character and motion capture performance from another scene and apply that to the model, but it's never going to be [that person]."

Image copyright Lionsgate Image caption Hoffman's character Plutarch Heavensbee played a leading role in The Hunger Games

Dr Garth Twa, a senior digital film production lecturer at Ravensbourne College in London and Pure Movies columnist, agrees. "With Philip Seymour Hoffman his appeal wasn't just his face, which would be easy to just CGI if it was an action movie.

"He was easily the most trusted and respected actor in Hollywood of a generation, so to get that level of acting and a nuanced performance wouldn't be possible."

Hoffman still appeared in the last two instalments of The Hunger Games as most of his scenes had been completed before his death, although a small amount of digital trickery with existing footage was still used to include him.

But one crucial scene which originally saw his character offer parting wisdom to Katniss Everdeen needed to be re-written, with Woody Harrelson's character offering the advice instead in the form of a written letter.

Fans still flocked to the cinema in their millions to see the final two films, and indeed to see how producers had dealt with Hoffman's death.

"This is an extremely cold-hearted thing to say but it's a cold-hearted business - I think studios benefit greatly from this," Dr Twa says.

"Everyone wants to see it, just like everyone wanted to see The Dark Knight with Heath Ledger [who had died before the film's release]."

"It's immediate public recognition, or free advertising."

Follow us on Facebook, on Twitter @BBCNewsEnts, or on Instagram at bbcnewsents. If you have a story suggestion email entertainment.news@bbc.co.uk.

A version of this story was first published on 6 February 2014