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

Newly created QJsonObject returns Null instead of Undefined in value()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.4.0 Alpha
    • 5.4.0 Alpha
    • Core: Other
    • None
    • c8edde3b833cb3d15377afed13d6fcd2e5fa5cd9

    Description

      The documented behavior for QJsonObject::value(const QString &key) is that an Undefined QJsonValue is returned when the key does not exist.
      When a QJsonObject is uninitialized (which means the d member is still null), the returned value is Null instead of Undefined.
      The behavior is caused directly by the QJsonObject::value() method, containing these lines:

        QJsonValue QJsonObject::value(const QString &key) const
        {
            if (!d)
                return QJsonValue();
            [...]
        }
      

      Attachments

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

        Activity

          People

            nierob Nierob
            borach Borach
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes