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

SetVariantString uses string by reference #2193

Open
3 tasks done
Alienmario opened this issue Jul 21, 2024 · 0 comments
Open
3 tasks done

SetVariantString uses string by reference #2193

Alienmario opened this issue Jul 21, 2024 · 0 comments
Labels
Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors.

Comments

@Alienmario
Copy link
Contributor

Help us help you

  • I have checked that my issue doesn't exist yet.
  • I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • I can always reproduce the issue with the provided description below.

SourceMod Version: 1.12.0.7031

Description

SetVariantString will keep a reference to Sourcepawn string variable, instead of copying its value.
Not sure if this is intentional, if it is, should probably be specified in the docs.

Problematic Code (or Steps to Reproduce)

The following results in both the input and variant being "IgniteLifetime"
The expected behavior is variant being "2".

char buffer[128];
buffer = "2";
SetVariantString(buffer);
buffer = "IgniteLifetime";
AcceptEntityInput(entity, buffer);
@psychonic psychonic added Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors. labels Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors.
Projects
None yet
Development

No branches or pull requests

2 participants