fix a crash in UiIfaceView :: getAvailableRotations() 61/91961/3
authorHermet Park <hermet@hermet.pe.kr>
Wed, 12 Oct 2016 09:52:17 +0000 (18:52 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Wed, 12 Oct 2016 09:54:18 +0000 (18:54 +0900)
don't access invalid pointer.

Change-Id: Ibdbf6df6adbe9f9807ed45b80e4d8ee3ffb9a715

src/include/efl/mobile/c/ui_view.h
src/include/interface/UiIfaceView.h
src/lib/interface/UiIfaceView.cpp

index 26cc5db..f19f3e5 100644 (file)
@@ -204,6 +204,8 @@ EAPI int ui_view_set_available_rotations(ui_view *view, const int *rotations, un
  *
  *  @return The array of rotation values
  *
+ *  @warning @c NULL will be returned if @a view or @a count is invalid.
+ *
  *  @see ui_view_set_available_rotations()
  */
 EAPI const int *ui_view_get_available_rotations(ui_view *view, unsigned int *count);
index 48f1578..ef48929 100644 (file)
@@ -117,6 +117,8 @@ public:
         *
         *  @return The array of rotation values.
         *
+        *  @warning @c nullptr will be returned if @a count is invalid.
+        *
         *  @see setAvailableRotations()
         */
        const int *getAvailableRotations(unsigned int *count);
index e50fb64..9f0272e 100644 (file)
@@ -227,6 +227,8 @@ int UiIfaceViewImpl::setAvailableRotations(const int *rotations, unsigned int co
 
 const int *UiIfaceViewImpl::getAvailableRotations(unsigned int *count)
 {
+       if (!count) return nullptr;
+
        static int rots[MAX_NUM_OF_AVAILABLE_ROTATIONS] = {0, 90, 180, 270};
 
        if (this->_rotationCount > 0) {