Free Support Forum - aspose.com

Presentation.Write() null ref exception after Slide.ChangeMaster()

Presentation.Write() fails with a null reference exception, after
cloning a number of slides from different files, and then using
ChangeMaster() on each slide to change the master. The cloning itself
and the change master call succeeds; it fails only when I get
Presentation.Write().



Partial stack trace:

System.NullReferenceException



at Aspose.PowerPoint.Presentation.x385156e102e7b12a()

at Aspose.PowerPoint.Presentation.Write(Stream stream)

at Aspose.PowerPoint.Presentation.Write(String file)



I checked to make sure that the master I’m changing to is NOT null.
However, it is definitely related to the ChangeMaster() call. If I
leave that off, the write succeeds. All slides and masters used are in
the presentation I am writing.



Any clues?


Thanks in advance.



[UPDATE] I answered my own question. The master slide was in the wrong presentation (one of the files I was copying from).



It would be nice if you throw an exception that explains the problem.


Exception with error message added in 2.2.4.0 hot fix.