Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for NullPointerException.
  • Loading branch information
Raptor399 committed Jun 1, 2013
1 parent 9c8baa5 commit 761a063
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/main/java/net/pms/dlna/CueFolder.java
@@ -1,7 +1,26 @@
/*
* PS3 Media Server, for streaming any medias to your PS3.
* Copyright (C) 2008 A.Brochard
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package net.pms.dlna;

import jwbroek.cuelib.*;
import net.pms.PMS;
import net.pms.dlna.Range.Time;
import net.pms.encoders.MEncoderVideo;
import net.pms.encoders.MPlayerAudio;
import net.pms.encoders.Player;
Expand Down Expand Up @@ -165,11 +184,15 @@ public void resolve() {
}

if (tracks.size() > 0 && addedResources.size() > 0) {
// last track
DLNAResource prec = addedResources.get(addedResources.size() - 1);
prec.getSplitRange().setEnd(prec.getMedia().getDurationInSeconds());
prec.getMedia().setDuration(prec.getSplitRange().getDuration());
LOGGER.debug("Track #" + childrenNumber() + " split range: " + prec.getSplitRange().getStartOrZero() + " - " + prec.getSplitRange().getDuration());
DLNAResource lastTrack = addedResources.get(addedResources.size() - 1);
Time lastTrackSplitRange = lastTrack.getSplitRange();
DLNAMediaInfo lastTrackMedia = lastTrack.getMedia();

if (lastTrackSplitRange != null && lastTrackMedia != null) {
lastTrackSplitRange.setEnd(lastTrackMedia.getDurationInSeconds());
lastTrackMedia.setDuration(lastTrackSplitRange.getDuration());
LOGGER.debug("Track #" + childrenNumber() + " split range: " + lastTrackSplitRange.getStartOrZero() + " - " + lastTrackSplitRange.getDuration());
}
}

PMS.get().storeFileInCache(playlistfile, Format.PLAYLIST);
Expand Down

0 comments on commit 761a063

Please sign in to comment.