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

Assigning null string to JSValue doesn't set IsNull #19

Closed
tarwich opened this issue Sep 27, 2013 · 2 comments
Closed

Assigning null string to JSValue doesn't set IsNull #19

tarwich opened this issue Sep 27, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@tarwich
Copy link

tarwich commented Sep 27, 2013

If you assign a null value to a variable and assign that variable to a JSValue, then using that JSValue in a JavaScript context is dangerous. It would help if assigning a null value to a JSValue would set the .IsNull or .IsUndefined flag.

using System;
using Awesomium.Core;

namespace Simple_Awesomnium_Test
{
    class Program
    {
        static void Main(string[] args)
        {
            String foo;
            JSValue bar;
            JSObject bin = new JSObject();

            foo = "Works";
            bar = foo;
            bin["value"] = bar;

            foo = null; 
            bar = foo;
            bin["value"] = bar; // Doesn't work
            // ^-- An unhandled exception of type 'System.ArgumentNullException' occurred in Awesomium.Core.dll

            if (bar.IsNull) return; // Doesn't help
            if (bar.IsUndefined) return; // Doesn't help either
            if (((String)bar) == null) return; // Fixes the problem
        }
    }
}
@ghost ghost assigned Perikles Oct 2, 2013
@Perikles Perikles added this to the 1.7.5 milestone Dec 11, 2014
@tarwich
Copy link
Author

tarwich commented Mar 18, 2016

Does that mean it's fixed?

@Perikles
Copy link

Yes, this has been fixed since 1.7.5 and 1.7.5.1 (available here).

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

No branches or pull requests

2 participants