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

Error reading tag from Photomechanic #327

Open
LaptopHeaven opened this issue May 3, 2023 · 1 comment
Open

Error reading tag from Photomechanic #327

LaptopHeaven opened this issue May 3, 2023 · 1 comment

Comments

@LaptopHeaven
Copy link

Ran into an issue working with certain images exported from photomechanic.
Looks like it's appending multiple null values to the end of the XMP data.

I was able to pinpoint the problem and fix it here.

if (data[data.Length - 1] == '\0')

From
if (data[data.Length - 1] == '\0')

To
while (data.Length > 0 && data[data.Length - 1] == '\0)

@PeterHuberSg
Copy link

I ran into the same problem, debugged it, solved it and then found this issue, which came up with the same solution.

In my case I had to remove more than 1000 '/0' from the string. Because of that, I changed the code slightly, to avoid creating 1000 strings:

if (data[data.Length - 1] == '\0') {
    int shorterLength = data.Length - 1;
    while (shorterLength>0 && data[shorterLength] == '\0') shorterLength--;
    data = data.Substring (0, shorterLength);
}

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

No branches or pull requests

2 participants