Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added null checks in case the user isn't using voice instructions #852

Merged
merged 2 commits into from
Apr 12, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class VoiceInstructionMilestone extends Milestone {
public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress routeProgress) {
if (isNewRoute(routeProgress)) {
clearInstructionList();
voiceInstructionLoader.cacheInstructions(routeProgress, true);
if (voiceInstructionLoader != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract this into a private method? Something like cacheInstructionsFromProgress to remove the duplicate code here?

voiceInstructionLoader.cacheInstructions(routeProgress, true);
}
}

if (shouldAddInstructions(routeProgress)) {
Expand All @@ -36,7 +38,9 @@ public boolean isOccurring(RouteProgress previousRouteProgress, RouteProgress ro

for (VoiceInstructions voice : stepVoiceInstructions) {
if (shouldBeVoiced(routeProgress, voice)) {
voiceInstructionLoader.cacheInstructions(routeProgress, false);
if (voiceInstructionLoader != null) {
voiceInstructionLoader.cacheInstructions(routeProgress, false);
}
announcement = voice.announcement();
ssmlAnnouncement = voice.ssmlAnnouncement();
stepVoiceInstructions.remove(voice);
Expand Down