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

DTVCCPacket: Avoid storing services with no codes #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bilboed
Copy link

@bilboed bilboed commented Dec 16, 2024

This is invalid, only the 0 service can have no codes

This is invalid, only the 0 service can have no codes
@ystreet
Copy link
Owner

ystreet commented Dec 16, 2024

Unit test please.

// Services allowed are either the padding 0 service or non-empty
// services
if service.number == 0 || !service.codes().is_empty() {
self.services.push(service);
Copy link
Owner

@ystreet ystreet Dec 16, 2024

Choose a reason for hiding this comment

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

Should an error be returned when the provided service is not used?

Copy link
Author

Choose a reason for hiding this comment

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

Good point. It maybe should to inform the caller that it's doing something wrong. Is there an appropriate error type to use ?

Copy link
Owner

Choose a reason for hiding this comment

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

The error type is already a WriterError. You may need to add another value to that enum for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants