My problem occurs when I try to load an already existing PopularityMeter Frame from a file to edit the rating data. I'm loading all the Frames of this type ("POPM") into a list of frames (FrameList), if there already are frames of this type I want to cast it to a TagLib::Id3v2::PopularityMeter since all the Objects within the list are of the type TagLib::Id3v2::Frame.
The Problem is every time the application reaches this static_cast<> it crashes without any errors.
Code:
TagLib::ID3v2::FrameList RatingFrames = ID3Tag->frameListMap()["POPM"];
TagLib::ID3v2::PopularimeterFrame* RatingFrame;
if (RatingFrames.size() > 0) {
RatingFrame = static_cast<TagLib::ID3v2::PopularimeterFrame*>(RatingFrames[0]);
}
else {
RatingFrame = new TagLib::ID3v2::PopularimeterFrame();
}
So I'm trying to edit the PopularityMeter Frame of an ID3v2 Tag that already has such a frame with the Rating data in it. What I thought would this code would do is set the first Frame of the Type PopularityMeter to the Object "RatingFrame".
Yet the Conversion from the TagLib::ID3v2::Frame class to the TagLib::ID3v2::PopularimeterFrame class results in a crash without any indication of what went wrong.