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

Comments

Projects
None yet
2 participants
@tarwich

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

@Perikles Perikles closed this Mar 18, 2016

@tarwich

This comment has been minimized.

Show comment
Hide comment
@tarwich

tarwich Mar 18, 2016

Does that mean it's fixed?

tarwich commented Mar 18, 2016

Does that mean it's fixed?

@Perikles

This comment has been minimized.

Show comment
Hide comment
@Perikles

Perikles Mar 18, 2016

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

Perikles commented Mar 18, 2016

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