Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3057

typeEncoderCache.LoadOrStore will panic when enc is nil

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 1.13.0
    • Component/s: None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Detailed steps to reproduce the problem?

      Call typeEncoderCache.LoadOrStore twice will panic when enc is nil.

      enc = v.(ValueEncoder) should be enc, _ = v.(ValueEncoder)

      
      

      _func (c *typeEncoderCache) LoadOrStore(rt reflect.Type, enc ValueEncoder) ValueEncoder {
      if v, loaded := c.cache.LoadOrStore(rt, enc); loaded

      { enc = v.(ValueEncoder) }

      return enc
      }_

       

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            wxblue@gmail.com x w
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: