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

Texture: Use default value for image setter. #25533

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Conversation

xlsfs
Copy link
Contributor

@xlsfs xlsfs commented Feb 19, 2023

If "data" is "undefined ", "serializeImage(data)" will report an error

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 19, 2023

If Source.data becomes undefined, it's an app level error. It's a nullable property so undefined is an invalid value.

Do you mind describing how Source.data gets this value in your particular use case?

@xlsfs
Copy link
Contributor Author

xlsfs commented Feb 20, 2023

I used the browser plugin "oslabs-beta/BACE", which used ".image = undefined"
Line 54 of this file: https://github.com/oslabs-beta/BACE/blob/dev/src/content/toJSON.js#L54

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 20, 2023

Do you mind changing this line instead:

set image( value ) {

to

set image( value = null ) { 

That should also do the trick.

If "source.data" is "undefined ", "source.serializeImage" will report an error, so set the default value to null
@xlsfs
Copy link
Contributor Author

xlsfs commented Feb 21, 2023

ok thanks, I have amended the commit

@Mugen87 Mugen87 added this to the r150 milestone Feb 21, 2023
@Mugen87 Mugen87 merged commit e523eb3 into mrdoob:dev Feb 21, 2023
@Mugen87 Mugen87 changed the title An error will be reported when calling Source.toJSON() Texture: Use default value for image setter. Feb 21, 2023
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