Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-57366

if (object == null) will cause application crash[QML Engine]

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P1: Critical
    • None
    • 5.8.0 Beta
    • None
    • Win8 VS2015

    Description

      import QtQuick 2.7
      import QtQuick.Window 2.2
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          MouseArea {
              anchors.fill: parent
              onClicked: {
      
                  test(1, 2, 3, 4);       //it can run normal
      
                  test({'name':'error'});  //the Application will crash after excute this code.
      
              }
          }
      
          function test(target){
      
              if (target == null) {
                  throw new TypeError('Cannot convert undefined or null to object');
              }
      
              // the code above, when target is an object and used "arguments" in this function. crash!
      
              /*
              //if modify like this, it's will be Ok!
              var objIsNull = (target == null);
      
              if (objIsNull) {
                  throw new TypeError('Cannot convert undefined or null to object');
              }*/
      
              console.log(arguments); //this palace need use arguments,it will trigger the app crash
      
              return target;
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            superd Super D
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes